neoversion 0.0.2 neoversion: ^0.0.2 copied to clipboard
Check if an app has a newer version on the app stores, and prompt the user to update if needed.
Flutter NeoVersion #
Check if a new version of a Flutter app is available on the app stores. The plugin uses the Peek-An-App API to get information about the latest version.
This plugin is heavily inspired by the new_version plugin, however, the APIs are NOT backwards-compatible.
Basic usage #
Create a new NeoVersion class instance wherever you want to check for new versions:
import 'package:neoversion/neoversion.dart';
final neoVersion = NeoVersion();
The package will use the package name from your Flutter project to identify the app on the app stores, however, you may also pass your own identifiers:
final neoVersion = NeoVersion(androidAppId: 'com.example.app', iOSAppId: 'com.example.app');
Once you have that, you can call the following method to prompt the user if a new version is available:
await neoVersion.showAlertIfNecessary(context: context);
You can also consume the version status manually and have custom behavior for the prompts:
final status = await neoVersion.getVersionStatus();
status.needsUpdate; // (boolean)
status.localVersion; // (string, the currently installed app's version)
status.appStoreVersion; // (string, the latest version on the app store)
await neoVersion.showUpdateDialog(context: context, status: status);
Customization #
The plugin's default dialog is very easy to customize. Please refer to the API Reference for more information.
Credits #
License #
MIT.