flutterdarttabletsmartphonedevicecheck

Can we check the device to be a smartphone or a tablet in Flutter?


I am actually trying to figure out if the app is running on a smartphone or tablet in my Flutter app, but the package device_info can only tell about the device, but not whether the device is a smartphone or tablet.

Is there a way we can do this by checking the size of the device?


Solution

  • Despite iOS having a clear separation between a phone and a tablet, this doesn't happen in Android. You need to base the choice based on screen width.

    Check this article to see an example on how to discriminate: Implementing master-detail layouts in Flutter