我想知道是否可以找到该设备是仿真器还是物理设备。
我不希望将我的应用安装在模拟器上。
只使用trust_fall
https://pub.dev/packages/trust_fall
使用检查设备是否在iOS / Android上越狱?
bool isJailBroken = await TrustFall.isJailBroken;
检查设备是真实的还是仿真的
bool isRealDevice = await TrustFall.isRealDevice;
此设备可以模拟位置-无需root!
bool canMockLocation = await TrustFall.canMockLocation;
((仅限ANDROID)检查应用程序是否正在外部存储上运行
bool isOnExternalStorage =等待TrustFall.isOnExternalStorage;检查设备是否违反以上任何条件
bool isTrustFall = await TrustFall.isTrustFall;
您可以使用flutter_is_emulator识别仿真器或模拟器。
bool isAnEmulator = await FlutterIsEmulator.isDeviceAnEmulatorOrASimulator;
为了使其正常工作,您需要先将应用程序安装到仿真器/模拟器。
您也可以使用另一个流行的flutter软件包device_info来做到这一点。
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
print('Is emulator: ${androidInfo.isPhysicalDevice}');G (4)"
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
print('Is simulator: ${iosInfo.isPhysicalDevice}');