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

Issue

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?

Many thanks
Mahi

Solution

Despite iOS has a clear separation between phone and 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: https://flutter.rocks/2018/01/28/implementing-adaptive-master-detail-layouts/

Answered By – Sergi and Replace

Answer Checked By – Gilberto Lyons (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *