title: How to check first time app launch in Flutter
body: <p>I am a beginner in a flutter, I have created my application but I want to check if the user opens the application for the first time after installing, I have seen <a href="https://stackoverflow.com/questions/44740617/check-if-an-application-is-on-its-first-run-with-flutter">this article</a> but did not know how that?</p>
  <p>This is the splash screen code, the code move the user directly to the Main screen after 3 sec, But I want to check if user first time opens the app and move the user to Welcome screen or if user not the first time and move the user to the Main screen.</p>
  <pre><code>import 'dart:async';
  import 'package:flutter/material.dart';
  import 'package:book_pen/main.dart';
  import 'package:book_pen/Welcome.dart';
  
  void main() {
    runApp(new MaterialApp(
      home: new SplashScreen(),
      routes: &lt;String, WidgetBuilder&gt;{
        '/HomePage': (BuildContext context) =&gt; new HomePage(),
        '/WelcomePage': (BuildContext context) =&gt; new WelcomePage()
      },
    ));
  }
  
  class SplashScreen extends StatefulWidget {
    @override
    _SplashScreenState createState() =&gt; new _SplashScreenState();
  }
  
  class _SplashScreenState extends State&lt;SplashScreen&gt; {
    startTime() async {
      var _duration = new Duration(seconds: 3);
  
      return new Timer(_duration, navigationPageHome);
    }
  
    void navigationPageHome() {
      Navigator.of(context).pushReplacementNamed('/HomePage');
    }
  
    void navigationPageWel() {
      Navigator.of(context).pushReplacementNamed('/WelcomePage');
    }
  
    @override
    void initState() {
      super.initState();
      startTime();
    }
  
  @override
    Widget build(BuildContext context) {
      Size size = MediaQuery.of(context).size;
      return Scaffold(
        body: Stack(
          children: &lt;Widget&gt;[
            Center(
              child: new Image.asset(
                'assets/images/SplashBack.jpg',
                width: size.width,
                height: size.height,
                fit: BoxFit.fill,
              ),
            ),
            Center(
                child: new Image.asset(
              'assets/images/BigPurppleSecSh.png',
              height: 150,
              width: 300,
            )),
          ],
        ),
      );
    }
  }
  
  </code></pre>