How to handle upgrade version of App in Flutter ?
Flutter Tutorial
Install Flutter in Win/Linux/Mac
Flutter Widgets:
Bottom Navigation Bar in Flutter
Auto Close Keyboard in Flutter
Screen size handling in Flutter
Flutter REST API
Flutter Advance
Wrap vs Builder vs OverBarFlow
Circular progress contain Icon
Flutter State management Comparison
Flutter Database
Flutter Token Expired Handling
Flutter Provider
Flutter GetX
Flutter with Native
Flutter Tips
Interview Questions
A common requirement when you launch an app on App Store or Play Store is, how to upgrade the app or show the upgraded version of app to the users. You can use this code with your app’s login or home page, whenever the user clicks the home page or re-login. This dialog will appear on the screen
Here you can set flag for user , if you want user can access flutter app after update app, then you can use this code and you can also customize this code as per your requirement
@override
void initState() {
super.initState();
Future.delayed(Duration.zero).then((value) {
Provider.of<NAME OF YOUR PROVIDER >(context, listen: false).newVersionOfApp(context);
});
}
void newVersionOfApp(BuildContext context) {
showDialog(
barrierDismissible: false,//visible /not visible background when dialog open
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Center(child: Text("Message")),
content: const Text(
"New Version of App",
textAlign: TextAlign.center,
),
actions: [
Center(
child: ElevatedButton(
style: //
child: const Text('update'),
onPressed: () {
// launchUrl(androidAppUrl);//here you can pass url of Google play store instead of this androidAppUrl
},
),
),
],
);
},
);
}