onStart method

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

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

Implementation

@override
Future<bool> onStart() async {
  if (await requestPermissions()) {
    _stream ??= stream;
    if (_stream == null) {
      warning(
          "Trying to start the stream probe '$runtimeType' which does not provide a measurement stream. "
          'Have you initialized this probe correctly or is the device connected?');
      return false;
    } else {
      _subscription =
          _stream!.listen(_onData, onError: _onError, onDone: _onDone);
    }
    return true;
  } else {
    return false;
  }
}