Skip to content

feat: WorkmanagerDebug handlers on web, linux and windows (same API as Android/iOS) #729

Description

@ened

Context

The debug-handler system (WorkmanagerDebug.setCurrent(...)) currently exists only on Android (Kotlin) and iOS/macOS (Swift). The web, linux and windows implementations are pure Dart, so they have no equivalent — debug information on those platforms is limited to what the developer prints themselves.

The API shape (see workmanager_android/.../WorkmanagerDebugHandler.kt):

  • TaskDebugInfo(taskName, uniqueName, inputData, startTime)
  • TaskResult(success, duration, error)
  • WorkmanagerDebug with onTaskStatusUpdate(taskInfo, status, result) and onExceptionEncountered(taskInfo, exception)
  • WorkmanagerDebug.setCurrent(handler) / getCurrent()
  • Built-in handlers: LoggingDebugHandler, NotificationDebugHandler

Proposal

Add a Dart-side mirror of the same API in the workmanager package (so the call site looks identical across platforms) and emit status updates from the Dart platform implementations:

  • WorkmanagerDebug.setCurrent(...) with the same handler contract (minus platform-specific context).
  • LoggingDebugHandler (prints to console) + web-capable NotificationDebugHandler (browser notifications on web; no-op elsewhere).
  • Wire emission:
    • web (workmanager_web): task start/completion/failure in the execution path, and dispatcher exceptions.
    • linux (workmanager_linux): in BackgroundTaskRunner.
    • windows (workmanager_windows): in the Dart execution path.

Acceptance criteria

  • WorkmanagerDebug.setCurrent(LoggingDebugHandler()) works identically on web, linux, windows (and stays a no-op-friendly default).
  • Custom handlers receive onTaskStatusUpdate / onExceptionEncountered with the same TaskDebugInfo/TaskStatus/TaskResult semantics.
  • Android/iOS keep their existing native API unchanged.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions