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

outdated

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

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:screen_state/screen_state.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    Screen screen = new Screen();
    StreamSubscription<ScreenStateEvent> subscription;
    subscription = screen.screenStateEvents.listen(onData);
  }

  onData(ScreenStateEvent event) {
    print(event);
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Screen State Example app'),
        ),
        body: new Center(
        ),
      ),
    );
  }
}
36
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