onStart method

  1. @override
Future<bool> onStart()
override

Callback when this executor is started. Returns true if successfully started, false otherwise.

Implementation

@override
Future<bool> onStart() async {
  // listen for event of the specified type and trigger as needed
  _subscription ??=
      AppTaskController().userTaskEvents.listen((userTask) async {
    if (userTask.task.name == configuration!.taskName &&
        userTask.state == configuration!.triggerCondition) {
      onTrigger();
    }
  });
  return true;
}