gpt4 book ai didi

dart - Flutter 检查应用程序是否在 iPad 或 iPhone 上运行

转载 作者:行者123 更新时间:2023-12-03 03:10:25 36 4
gpt4 key购买 nike

我在我的应用程序中使用振动,因为 iPad 不支持它,所以我想从我的应用程序中删除一个振动设备的按钮。

那么,我如何才能知道我的应用程序是在 iPad 还是 iPhone 上运行呢?

最佳答案

device_info 的用法是正确的,但是应该使用 model 属性:

Future<bool> isIpad() async{
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
IosDeviceInfo info = await deviceInfo.iosInfo;
if (info.model.toLowerCase().contains("ipad")) {
return true;
}
return false;
}

关于dart - Flutter 检查应用程序是否在 iPad 或 iPhone 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53763886/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com