I use the Below dependency in my Flutter project to find if it is iPhone, iPad or Android device. This will perfectly work until the new XCODE update which has iPad simulators with M2 and M4 Chip.
When I run my app in iPad Pro 13 inch (M4) from below function, I got False which means this is not iPad
So is there anyone who facing the same issue or has the solution to this problem or has any alternative dependency that finds the iPad with M Chips.
I’d be very thankful if you read it here.
device_info_plus: ^10.1.0
import 'package:device_info_plus/device_info_plus.dart';
Future<bool> isIpad() async {
print('isIpad Function Called');
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
IosDeviceInfo info = await deviceInfo.iosInfo;
if (info.model.toLowerCase().contains("ipad")) {
print('This is iPad');
return true;
} else if (info.model.toLowerCase().contains("iphone")) {
print('This is iPhone');
return false;
} else {
print('This is Android');
return false;
}
}