Flutter 如何检查设备是模拟器还是物理设备?

Flutter 如何检查设备是模拟器还是物理设备?,flutter,Flutter,我想知道是否有任何方法可以找到该设备是模拟器还是物理设备 我不希望我的应用程序安装在模拟器上 您可以使用来识别仿真器或模拟器 bool isAnEmulator = await FlutterIsEmulator.isDeviceAnEmulatorOrASimulator; 为了使其正常工作,您需要首先将应用程序安装到模拟器/模拟器 您还可以使用另一个流行的颤振包来完成此操作 DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); AndroidD

我想知道是否有任何方法可以找到该设备是模拟器还是物理设备

我不希望我的应用程序安装在模拟器上

您可以使用来识别仿真器或模拟器

bool isAnEmulator = await FlutterIsEmulator.isDeviceAnEmulatorOrASimulator;
为了使其正常工作,您需要首先将应用程序安装到模拟器/模拟器

您还可以使用另一个流行的颤振包来完成此操作

DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
print('Is emulator: ${androidInfo.isPhysicalDevice}');

IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
print('Is simulator: ${iosInfo.isPhysicalDevice}'); 
使用

trust_fall有以下检查:

检查设备是否在iOS/Android上越狱

bool isJailBroken = await TrustFall.isJailBroken;
检查设备是真实的还是仿真的

bool isRealDevice = await TrustFall.isRealDevice;
此设备可以模拟位置-无需root

bool canMockLocation = await TrustFall.canMockLocation;
(仅限ANDROID)检查应用程序是否在外部存储上运行

bool isOnExternalStorage=等待信任下降。isOnExternalStorage; 检查设备是否违反上述任何一项

bool isTrustFall = await TrustFall.isTrustFall;

哇!我没想到会有这么快的答复。我认为这将被关闭或否决。我将尝试为这个问题提供详细的答案。谢谢你理解这个问题。投票通过。@讽刺的是,欢迎您,同时检查更新的答案。我还包括了一个插件hanks@Midhun,我相信它也会帮助其他人。这是一般情况。我早上提出了一个问题。如果你有时间看一看。我没有在DeviceInfo插件中找到ISP物理设备。谢谢你的回答。我会尽力让你知道的。投票通过。信任下降给出了一些运行时错误。看起来与Flatter的最新版本不兼容。我检查了GitHub,发现这个问题已经存在很长时间了。我的建议是现在不要使用这个插件。