app_version_update 2.0.2 app_version_update: ^2.0.2 copied to clipboard
An easy and quick way to check if the local app is updated with the same version in their respective stores (Play Store / Apple Store ).
Retrieve version and url for local app update against store app Android and iOS
Features #
Using as reference packages like in_app_update , version_check.
Compares local version with the respective store version for the purpose of detecting user-side version updates.
It also provides widgets like dialog , bottom sheets and pages for you to display the update option to the user.
Getting started #
$ flutter pub add app_version_update
or add in your dependencies
dependencies:
app_version_update: <latest>
to use this app you need to have the app hosted in stores.
To test, you can manually downgrade your pubspec.yaml from your version:
, when you run your local version
it will be different from the store version
Usage #
final appleId = '1234567890'; // If this value is null, its packagename will be considered
final playStoreId = 'com.example.app'; // If this value is null, its packagename will be considered
final country = 'br' // If this value is null 'us' will be the default value
await AppVersionUpdate.checkForUpdates(
appleId: appleId, playStoreId: playStoreId, country: country)
.then((data) async {
print(data.storeUrl);
print(data.storeVersion);
if(data.canUpdate!){
//showDialog(... your custom widgets view)
//or use our widgets
// AppVersionUpdate.showAlertUpdate
// AppVersionUpdate.showBottomSheetUpdate
// AppVersionUpdate.showPageUpdate
AppVersionUpdate.showAlertUpdate(
appVersionResult: data, context: context);
}
});
Customize the Alert Dialog
// you also have some options to customize our Alert Dialog
AppUpdateVersion.showAlertUpdate({
@required AppVersionResult? appVersionResult,
@required BuildContext? context,
String? title = 'New version available',
String? content = 'Would you like to update your application?',
String? cancelButtonText = 'Update later',
String? updateButtonText = 'Update',
ShowModalType? modalType = ShowModalType.alert_dialog, //anothers: page and bottom_sheet
Color? backgroundColor = Colors.white,
TextStyle? cancelTextStyle = const TextStyle(color: Colors.red),
TextStyle? updateTextStyle = const TextStyle(color: Colors.green),
TextStyle? titleTextStyle = const TextStyle(
fontSize: 20.0, fontWeight: FontWeight.w700, color: Colors.black),
ButtonStyle? cancelButtonStyle = const ButtonStyle(
overlayColor: MaterialStatePropertyAll(Colors.black12)),
ButtonStyle? updateButtonStyle = const ButtonStyle(
overlayColor: MaterialStatePropertyAll(Colors.black12),
),
})
Customize the our bottom sheet
AppUpdateVersion.showBottomSheetUpdate(
{@required BuildContext? context,
@required AppVersionResult? appVersionResult,
bool? mandatory = false,
String? title = 'New version avaible',
Widget? content}) async {
await showModalBottomSheet(
isDismissible: !mandatory!,
context: context!,
builder: (context) => BottomSheetUpdateVersion(
appVersionResult: appVersionResult,
mandatory: mandatory,
content: content,
title: title,
));
}
Customize the Page
// you also have some options to customize our Page
AppUpdateVersion.showPageUpdate(
{@required BuildContext? context,
@required AppVersionResult? appVersionResult,
bool? mandatory = false,
Widget? page}) async {
Navigator.push(
context!,
MaterialPageRoute(
builder: (context) =>
page ??
UpdateVersionPage(
mandatory: mandatory,
appVersionResult: appVersionResult,
)));
}
Additional information #
Next Updates | status |
---|---|
Mandatory or optional update | released |
Create TestMode | development |
Bottom sheet widget | released |
Page widget | released |
Handle Exceptions | development |
New options custom widgets | released |
Automatic country detection | released |
Modularize files | listed |
This project is at an initial level, more functions will be included as
So any suggestion and contribution is welcome.