BackgroundRuntimeWebPlugin class final

Web implementation of BackgroundRuntimePlatform.

Web support is best-effort. Background execution is limited by browser capabilities. Downloads use the anchor-element fallback to avoid CORS restrictions of XMLHttpRequest. Audio playback uses the HTMLAudioElement API. Notification actions are delivered via the Media Session API with a keyboard media-key fallback.

Known limitations:

  • No true background execution (browsers do not support it)
  • No foreground service concept
  • No persistent notifications
  • Downloads may not survive page navigation
  • Audio playback stops when the page is hidden on mobile
  • Previous/next actions require Media Session API support or media keys
Inheritance
  • Object
  • PlatformInterface
  • BackgroundRuntimeWebPlugin

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancelDownload(String taskId) Future<void>
Cancel the download identified by taskId.
downloadEvents() Stream<DownloadEvent>
A broadcast stream of download progress and state events.
initialize(BackgroundRuntimeConfig config) Future<void>
Initialize the background runtime with config.
lifecycleEvents() Stream<RuntimeLifecycle>
A broadcast stream of runtime lifecycle events.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notificationActionEvents() Stream<NotificationAction>
A broadcast stream of notification action events.
pauseAudio() Future<void>
Pause the current audio playback.
pauseDownload(String taskId) Future<void>
Pause the download identified by taskId.
playAudio(AudioTrack track) Future<void>
Begin audio playback of the given track.
playerState() Stream<PlayerState>
A broadcast stream of player state changes.
resumeAudio() Future<void>
Resume the current audio playback.
resumeDownload(String taskId) Future<void>
Resume the download identified by taskId.
seekAudio(Duration position) Future<void>
Seek to position in the current audio track.
shutdown() Future<void>
Shut down the background runtime and release all resources.
startDownload(DownloadRequest request) Future<String>
Start a file download described by request. Returns a unique task identifier.
stopAudio() Future<void>
Stop the current audio playback.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

registerWith(Registrar registrar) → void