1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-23 05:19:22 +00:00
comunicmobile/lib/helpers/version_helper.dart

22 lines
572 B
Dart
Raw Normal View History

2021-03-14 16:44:29 +00:00
import 'package:comunic/utils/flutter_utils.dart';
import 'package:package_info_plus/package_info_plus.dart';
2021-02-20 08:24:51 +00:00
import 'package:version/version.dart';
/// 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();
}
/// 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);
}