dartflutter

Flutter check if app is running in iPad or iPhone


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;
    }