device_type 0.0.6 copy "device_type: ^0.0.6" to clipboard
device_type: ^0.0.6 copied to clipboard

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

example/lib/main.dart

import 'package:device_type/device_type.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late String deviceType;

  @override
  void initState() {
    super.initState();
  }

  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'),
        ),
      ),
    );
  }
}
5
likes
130
pub points
74%
popularity

Publisher

verified publishervinothmuthu.in

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

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on device_type