title: How to force users to update app from play store in Flutter using in_app_update
body: <p>I want the users of my app to always have the latest version. If they don't have the latest version, it should download the latest version from play store first as shown in the image.  </p>
  
  <p><a href="https://i.stack.imgur.com/Oe0nY.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Oe0nY.jpg" alt="Forced Update"></a></p>
  
  <p>I found a package called <a href="https://pub.dev/packages/upgrader" rel="noreferrer">Upgrader</a> but this just gives a prompt. It is not linked to play store as shown in image.  </p>
  
  <p><strong>Edit</strong></p>
  
  <p>As suggested by <strong>Maadhav Sharma</strong>, now I am using the <a href="https://pub.dev/packages/in_app_update" rel="noreferrer">in_app_update</a> package but it says <strong>no update available</strong>.  </p>
  
  <p>This is my code:  </p>
  
  <pre class="lang-dart prettyprint-override"><code>....
  
  class _TnPState extends State&lt;TnP&gt; {
    ThemeBloc _themeBloc;
    FirebaseMessaging _firebaseMessaging;
    NotificationBloc _notificationBloc;
    String _test;
  
    @override
    void initState() {
      _themeBloc = ThemeBloc();
      _firebaseMessaging = FirebaseMessaging();
      _notificationBloc = NotificationBloc();
      _firebaseMessaging.configure(
        onMessage: (notification) async =&gt; _notificationBloc.yes(),
        onResume: (notification) async =&gt; _notificationBloc.yes(),
        onLaunch: (notification) async =&gt; _notificationBloc.yes(),
      );
      checkForUpdate();
      super.initState();
    }
  
    Future&lt;void&gt; checkForUpdate() async {
      InAppUpdate.checkForUpdate().then((info) {
        String display = info.toString();
        setState((){
          _test = display;
        });
      });
    }
  
    @override
    Widget build(BuildContext context) {
      return StreamBuilder&lt;AppTheme&gt;(
        stream: _themeBloc.themeStream,
        initialData: AppTheme.Light,
        builder: (context, AsyncSnapshot&lt;AppTheme&gt; snapshot) {
          return MaterialApp(
            title: 'TnP',
            debugShowCheckedModeBanner: false,
            theme: appThemeData[snapshot.data],
            home: _test==null ?
                  Container() : 
                  InAppUpdateScreen(display: _test),//SplashScreen(),
          );
        },
      );
    }
  }
  
  </code></pre>
  
  <p><code>InAppUpdateScreen</code> just displays the text.<br>
  App in play store shows update is available:<br>
  <a href="https://i.stack.imgur.com/C0exW.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/C0exW.jpg" alt="App in play store"></a></p>
  
  <hr>
  
  <p>But the app which is an <strong>older version installed via playstore</strong> shows no update:<br>
  <a href="https://i.stack.imgur.com/PrUWt.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/PrUWt.jpg" alt="No update in app"></a></p>
  
  <hr>
  
  <p>Any idea how to solve this?</p>