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 {
|
2024-06-05 16:13:56 +08:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|