Flutter: How to show application updates is available.

Flutter: How to show application updates is available.

Hello Friends,

Why must we show the new application version available to customers or users? Every new release with new functionality and developer resolves bugs and makes the application a more user-friendly experience.

So users redirect to the play store and app store to update an application to the new version.

Let's start implementation.

So for the version check. I used this class.

image.png

For download from here

Next Step

Here Create an object of the AppVersionChecker class. It takes three arguments.

final String? current versions if [currentVersion] is null the [currentVersion] will take the Flutter package version, String? appId if [appId] is null the [appId] will take the Flutter package identifier, final AndroidStore androidStore default will be AndroidStore.GooglePlayStore

image.png

after a network call. This function return

  • canUpdate return true if update is available
  • currentVersion return current app version
  • newVersion return the new app version
  • appURL return the app URL
  • errorMessage returns an error message if found else it will return null

Now based on the above response. We will show the new application version available alert in the application based on our requirements.

I used the below code to check update is major or minor.

image.png

There are many other dependencies available.

Thank you, and feel free to add comments for questions and suggestions. I will try my best to improve it.