executeTask method
void
executeTask(
- BackgroundTaskHandler backgroundTask
A helper function so you only need to implement a BackgroundTaskHandler
Implementation
void executeTask(final BackgroundTaskHandler backgroundTask) {
WidgetsFlutterBinding.ensureInitialized();
DartPluginRegistrant.ensureInitialized();
_backgroundChannel.setMethodCallHandler((call) async {
final inputData = call.arguments["be.tramckrijte.workmanager.INPUT_DATA"];
return backgroundTask(
call.arguments["be.tramckrijte.workmanager.DART_TASK"],
inputData == null ? null : jsonDecode(inputData),
);
});
_backgroundChannel.invokeMethod("backgroundChannelInitialized");
}