device_type

A new Flutter plugin used to determine whether the device is a Phone, Phablet, Tablet, or a Larger Device like a Desktop.

Essential Guide

Flutter Device Type Medium

Installation

  1. Add the latest version of package to your pubspec.yaml (and rundart pub get):
dependencies:
  device_type: ^0.0.6
  1. Import the package and use it in your Flutter App.
import 'package:device_type/device_type.dart';


String _getDeviceType(BuildContext context) {
  return DeviceType.getDeviceType(context);
}

@override
Widget build(BuildContext context) {
  deviceType = _getDeviceType(context);
  return MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text('Plugin Device Type'),
      ),
      body: Center(
        child: Text('Running on: $deviceType\n'),
      ),
    ),
  );
}

Package Documentation

Example of using the library to determine whether the device is a Phone, Phablet, Tablet, or a Larger Device.

Find Package at pub.dev

Example of using the library to determine whether the device is a Phone, Phablet, Tablet, or a Larger Device.