This commit is contained in:
12
lib/utils/appversion.dart
Normal file
12
lib/utils/appversion.dart
Normal file
@ -0,0 +1,12 @@
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class AppVersion {
|
||||
static late String version;
|
||||
|
||||
static Future<void> init() async {
|
||||
final String yaml = await rootBundle.loadString('pubspec.yaml');
|
||||
final RegExpMatch? match = RegExp(r'^version:\s*(.*)$', multiLine: true).firstMatch(yaml);
|
||||
final String? v = match?.group(1)!.replaceAll('"', '').replaceAll("'", '').trim();
|
||||
version = v ?? "";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user