13 lines
408 B
Dart
13 lines
408 B
Dart
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 ?? "";
|
|
}
|
|
}
|