app-starlock/lib/tools/platform_info_services.dart

19 lines
537 B
Dart
Executable File

import 'package:get/get.dart';
import 'package:package_info_plus/package_info_plus.dart';
class PlatformInfoService extends GetxService {
static PlatformInfoService? get to {
if(Get.isRegistered<PlatformInfoService>()){
return Get.find<PlatformInfoService>();
}
return null;
}
late PackageInfo _packageInfo;
PackageInfo get info => _packageInfo;
Future<PlatformInfoService> init() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
_packageInfo = packageInfo;
return this;
}
}