onPause method
Callback when this executor is paused. Returns true if successfully paused, false otherwise.
Implementation
@override
Future<bool> onPause() async {
if (timer != null) timer!.cancel();
// check if there are some buffered data that needs to be collected before pausing
try {
Datum? datum = await getDatum();
if (datum != null) addData(datum);
} catch (error) {
addError(error);
}
return true;
}