screen_state 0.1.1 copy "screen_state: ^0.1.1" to clipboard
screen_state: ^0.1.1 copied to clipboard

outdated

A plugin for reporting screen events while the flutter application is running in background. Works for Android only.

screen_state #

pub package

A Flutter plugin for tracking the screen state.

Install #

Add screen_state as a dependency in pubspec.yaml. For help on adding as a dependency, view the documentation.

Usage #

All incoming data points are streamed with a StreamSubscription which is set up by calling the listen() method on the screenStateStream stream object.

Given a method _onData(ScreenStateEvent event) the subscription can be set up as follows:

Screen _screen;
StreamSubscription<ScreenStateEvent> _subscription;
...
void onData(ScreenStateEvent event) {
    print(event);
}

void startListening() {
    _screen = new Screen();
    try {
      _subscription = _screen.screenStateStream.listen(onData);
    } on ScreenStateException catch (exception) {
      print(exception);
    }
}

The stream can also be cancelled again by calling the cancel() method:

  void stopListening() {
    _subscription.cancel();
  }
35
likes
0
pub points
91%
popularity

Publisher

verified publishercachet.dk

A plugin for reporting screen events while the flutter application is running in background. Works for Android only.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on screen_state