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 {
  void check() {
    if (configuration!.triggerCondition != null &&
        configuration!.triggerCondition!()) {
      onTrigger();
    }
  }

  // check the condition immediately on resume, then once per period.
  check();
  timer = Timer.periodic(configuration!.period, (_) => check());
  return true;
}