enqueueWorkIntent function
Enqueues a intent
to work in the background.
You can specify input data and constraints like network or battery status to the background work via the WorkIntent.
Example:
enqueueWorkIntent(WorkIntent(
identifier: 'task1',
initialDelay: Duration(seconds: 59),
constraints: WorkConstraints(
networkType: NetworkType.connected,
batteryNotLow: true,
),
input: <String, dynamic>{
'counter': counter,
},
));
For the iOS platform, all identifier
s must be registered in the Info.plist
file,
please see the integration guide for more details.
The identifier
will always be prepended to the tags
properties,
which you can retrieve from the WorkPayload
when handling the work later.
Implementation
Future<bool> enqueueWorkIntent(WorkIntent intent) => impl.enqueueWorkIntent(intent);