2021-03-14 16:44:29 +00:00
|
|
|
import 'package:comunic/utils/flutter_utils.dart';
|
2021-02-20 07:58:03 +00:00
|
|
|
import 'package:package_info/package_info.dart';
|
2021-02-20 08:24:51 +00:00
|
|
|
import 'package:version/version.dart';
|
2021-02-20 07:58:03 +00:00
|
|
|
|
|
|
|
/// Application version helper
|
|
|
|
///
|
|
|
|
/// @author Pierre Hubert
|
|
|
|
|
|
|
|
class VersionHelper {
|
|
|
|
static PackageInfo _info;
|
|
|
|
|
|
|
|
static Future<void> ensureLoaded() async {
|
2021-03-14 16:44:29 +00:00
|
|
|
if (!isWeb) _info = await PackageInfo.fromPlatform();
|
2021-02-20 07:58:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Get current version information
|
|
|
|
static PackageInfo get info => _info;
|
2021-02-20 08:24:51 +00:00
|
|
|
|
|
|
|
/// Get current application version, in parsed format
|
|
|
|
static Version get version => Version.parse(info.version);
|
2021-02-20 07:58:03 +00:00
|
|
|
}
|