device_detail 0.0.4 copy "device_detail: ^0.0.4" to clipboard
device_detail: ^0.0.4 copied to clipboard

A new Flutter library for getting platform information.

A library for getting platform information.

This lightweight package allows in a very simple and optimized way to obtain Info about the platform on which it is running. It's multi-platform, and supports mobile, desktop, and the browser.

Using #

The easiest way to use this library is to call the class as follows. Multiple instances are not being created since thanks to a factory constructor it always returns an internal singleton:

import 'package:device_detail/device_detail.dart';

if (DeviceDetail().isMobile) {
  print('The current platform is Mobile');
}  

if (DeviceDetail().isDesktopOrWeb) {
  print('The current platform is Desktop or Web');
}

if (DeviceDetail().isDesktop) {
  print('The current platform is Desktop');
}

if (DeviceDetail().isWeb) {
  print('The current platform is web');
}

If instead you want to ask individually for each platform supported by Flutter:

if (DeviceDetail().isIOS) {
  print('The current platform is iOS');
}

if (DeviceDetail().isAndroid) {
  print('The current platform is Android');
}

if (DeviceDetail().isFuchsia) {
  print('The current platform is Fuchsia');
}

if (DeviceDetail().isWindows) {
  print('The current platform is Windows');
}

if (DeviceDetail().isLinux) {
  print('The current platform is Linux');
}

if (DeviceDetail().isMacOS) {
  print('The current platform is macOS');
}
2
likes
130
pub points
32%
popularity

Publisher

verified publishernimusoftlabs.com

A new Flutter library for getting platform information.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on device_detail