on_upgrade library Null safety

Provides the ability to check if the currently started app is an upgrade.

An upgrade is defined as the first start of a new app version, compared to the last known version. All versions should follow the Dart package versioning guidelines.

Can be used with the given persistence implementation (shared preferences) or with a custom implementation of the getter / setter logic for the last known version. The currently running app version is always determined by the version loaded via package_info_plus.


Contains the upgrade check functionality
Wraps the upgrade state of the app.




VersionLookup = Future<String> Function()
Custom version lookup with the signature Future<String> func() async {}. Must return an empty string if no last version is given during initial start.
VersionUpdate = Future<bool> Function([String? version])
Custom version update with the signature Future<bool> func([String? version]) async {}. Use OnUpgrade().getCurrentVersionString to get the currently running app version.