onResume method

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

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

Implementation

@override
Future<bool> onResume() async {
  // create a recurrent timer that checks the conditions periodically
  timer = Timer.periodic(configuration!.period, (_) {
    debug(
        '$runtimeType - checking; resumeCondition: ${configuration!.resumeCondition}, pauseCondition: ${configuration!.pauseCondition}');
    if (configuration!.resumeCondition != null &&
        configuration!.resumeCondition!()) super.onResume();
    if (configuration!.pauseCondition != null &&
        configuration!.pauseCondition!()) super.onPause();
  });
  return true;
}