app-starlock/lib/tools/platform_info_services.dart

19 lines
537 B
Dart
Raw Permalink Normal View History

2023-07-10 17:50:31 +08:00
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;
}
2023-07-15 15:11:28 +08:00
late PackageInfo _packageInfo;
2023-07-10 17:50:31 +08:00
PackageInfo get info => _packageInfo;
Future<PlatformInfoService> init() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
_packageInfo = packageInfo;
return this;
}
}