nc-photos/app/lib/mobile/android/android_info.dart
2022-04-06 02:37:58 +08:00

27 lines
597 B
Dart

import 'package:device_info_plus/device_info_plus.dart';
/// System info for Android
///
/// Only meaningful when running on Android. Must call [init] before accessing
/// the data fields
class AndroidInfo {
factory AndroidInfo() => _inst;
AndroidInfo._({
required this.sdkInt,
});
static Future<void> init() async {
final info = await DeviceInfoPlugin().androidInfo;
final sdkInt = info.version.sdkInt!;
_inst = AndroidInfo._(
sdkInt: sdkInt,
);
}
static late final AndroidInfo _inst;
/// Corresponding to Build.VERSION.SDK_INT
final int sdkInt;
}