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 {
  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;
  }
}