Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. @override
  2. void initState() {
  3. super.initState();
  4. new Timer(new Duration(milliseconds: 200), () {
  5. checkFirstSeen();
  6. });
  7. }
  8.  
  9. Future checkFirstSeen() async {
  10. SharedPreferences prefs = await SharedPreferences.getInstance();
  11. bool _seen = (prefs.getBool('seen') ?? false);
  12.  
  13. if (_seen) {
  14. Navigator.of(context).pushReplacement(
  15. new MaterialPageRoute(builder: (context) => new MyAppState()));
  16. } else {
  17. prefs.setBool('seen', true);
  18. Navigator.of(context).pushReplacement(
  19. new MaterialPageRoute(builder: (context) => new AskPermissions()));
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement