onStart method

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

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

Implementation

@override
Future<bool> onStart() async {
  getMeasurement().then((measurement) {
    if (measurement != null) addMeasurement(measurement);
    // automatically stop this probe after it is done collecting the measurement
    Future.delayed(const Duration(seconds: 1), () => stop());
  }, onError: (Object error) => addError(error));

  return true;
}