How to update Flutter App when new version is available?

· 3 min read
How to update Flutter App when a new version is available?
How to update Flutter App when a new version is available?

Sometimes your Flutter app may not function properly due to updates. So, in this article, we will see how to update Flutter App when a new version is available.

How to update Flutter App when a new version is available?

When building a flutter mobile application with a current version sometimes it may happen that the currently developed application may not work properly. It may not work the same way it is working today because of updates in packages. So what we need to do is we can keep our application auto-update. So that whenever new updates are available it gets auto-updated. We have the below possibilities with flutter.

Make updates inside the app. Display two kinds of notifications if the app has the new version.

Flutter Application Update
Flutter Application Update

When a newer app version is available in the app store, a simple alert prompt widget or card is displayed.

flutter app update
flutter app update

Refer to the following package – https://pub.dev/packages/upgrader

Use Firebase in-app messaging. It gives flexibility in the messages and forms of notifications. But a lot more boilerplate code and work. But you can use it for other messages and notifications when your app is growing. https://firebase.google.com/docs/in-app-messaging

One way to implement this is to use a variable and compare that variable from a database. It could be Firebase or any other. For this example, let’s use Firebase’s real-time database.

int version = 1;
void checkLatestVersion(){
    
//Here i am getting just the value of the latest version stored on firebase.    
databaseReference.child("version").child("latestRealase").once().then((snapshot){
      if(snapshot.value != null){
          int versionNumberFromDatabase = int.parse(snapshot.value));
          if(versionNumberFromDatabase>version){
             print("the app needs to be updated");
             //here you can create a dialog to display and force users to update
          }else{
             print("The app doesn't to be need updated ");
          }
      }
     });
 }

Conclusion:

Thanks for being with us on a Flutter Journey!

So, in this article, we have seen how to update Flutter App when a new version is available. Also, feel free to comment and provide any other suggestions regarding Flutter.

Flutter Agency is our portal Platform dedicated to Flutter Technology and Flutter Developers. Also, the portal is full of cool resources from Flutter like Flutter Widget GuideFlutter Projects, Code libs and etc.

Flutter Agency is one of the most popular online portals dedicated to Flutter Technology. Daily thousands of unique visitors come to this portal to enhance their knowledge of Flutter.

Leave a Reply