Flutter check if app is running in iPad or iPhone

Issue

I am using vibration in my app and since iPad doesn’t support it, so I wanted to remove a button from my app which vibrates the device.

So, how can I get to know if my app is running in iPad or iPhone?

Solution

Use device_info

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

Answered By – user6274128

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published