onResume method
Callback when this executor is resumed. Returns true if successfully resumed, false otherwise.
Implementation
@override
Future<bool> onResume() async {
// listen for event of the specified type and resume/pause as needed
_subscription = AppTaskController().userTaskEvents.listen((userTask) async {
if (userTask.task.name == configuration!.taskName) {
if (userTask.state == configuration!.resumeCondition) {
await super.onResume();
if (configuration!.pauseCondition == null) super.onPause();
}
if (configuration!.pauseCondition != null &&
userTask.state == configuration!.pauseCondition!) super.onPause();
}
});
return true;
}