feat:参照研听的基础工程

This commit is contained in:
jingyun
2026-06-18 15:02:28 +08:00
commit 364fc837b3
367 changed files with 16495 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
/// The plugin class for retrieving the Android ID.
class AndroidId {
const AndroidId();
/// The method channel used to interact with the native platform.
static const _methodChannel = MethodChannel('android_id');
/// Calls the native method to retrieve the Android ID.
Future<String?> getId() async {
final isAndroid =
!kIsWeb && defaultTargetPlatform == TargetPlatform.android;
if (!isAndroid) return null;
return _methodChannel.invokeMethod<String?>('getId');
}
Future<String?> getImei() async {
final isAndroid =
!kIsWeb && defaultTargetPlatform == TargetPlatform.android;
if (!isAndroid) return null;
return _methodChannel.invokeMethod<String?>('getImei');
}
Future<String?> getMaAddress() async {
final isAndroid =
!kIsWeb && defaultTargetPlatform == TargetPlatform.android;
if (!isAndroid) return null;
return _methodChannel.invokeMethod<String?>('getMacAddress');
}
// Future<String?> getOaid() async {
// final isAndroid =
// !kIsWeb && defaultTargetPlatform == TargetPlatform.android;
// if (!isAndroid) return null;
//
// return _methodChannel.invokeMethod<String?>('getOaid');
// }
Future<bool?> isRoot() async {
final isAndroid =
!kIsWeb && defaultTargetPlatform == TargetPlatform.android;
if (!isAndroid) return null;
return _methodChannel.invokeMethod<bool?>('checkRoot');
}
Future<bool?> isEmulator() async {
final isAndroid =
!kIsWeb && defaultTargetPlatform == TargetPlatform.android;
if (!isAndroid) return null;
return _methodChannel.invokeMethod<bool?>('checkIsEmulator');
}
}