Workmanager class
Properties
-
hashCode
→ int
-
The hash code for this object. [...]
read-only, inherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString()
→ String
-
Returns a string representation of this object.
inherited
Static Methods
-
cancelAll()
→ Future<void>
-
Cancels all jobs
-
cancelByTag(String tag)
→ Future<void>
-
Cancels a job by its tag
-
cancelByUniqueName(String uniqueName)
→ Future<void>
-
Cancels a job by its unique name
-
defaultCallbackDispatcher(EchoCallbackFunction echoFunction)
→ void
-
A helper function so you only need to implement a EchoCallbackFunction
-
initialize(Function callbackDispatcher, { bool isInDebugMode })
→ Future<void>
-
This call is required if you wish to use the WorkManager plugin.
callbackDispatcher is a top level function which will be invoked by Android
isInDebugMode true will post debug notifications with information about when a job should have run
-
registerOneOffTask(String uniqueName, String echoValue, { String tag, ExistingWorkPolicy existingWorkPolicy, Duration initialDelay: _noDuration, WorkManagerConstraintConfig constraints, BackoffPolicy backoffPolicy, Duration backoffPolicyDelay: _noDuration })
→ Future<void>
-
Schedule a one off task
A unique name is required so only one job can be registered.
The echoValue is the value that will be returned in the EchoCallbackFunction
-
registerPeriodicTask(String uniqueName, String echoValue, { Duration frequency, String tag, ExistingWorkPolicy existingWorkPolicy, Duration initialDelay: _noDuration, WorkManagerConstraintConfig constraints, BackoffPolicy backoffPolicy, Duration backoffPolicyDelay: _noDuration })
→ Future<void>
-
Schedules a periodic task that will run every provided
frequency
.
A unique name is required so only one job can be registered.
The echoValue is the value that will be returned in the EchoCallbackFunction
a frequency is not required and will be defaulted to 15 minutes if not provided.