platform_detail 1.0.0 copy "platform_detail: ^1.0.0" to clipboard
platform_detail: ^1.0.0 copied to clipboard

outdated

A lightweight library to obtain details of the current platform in a much more complete and simple way.

A library for getting platform details.

pub package

This lightweight package allows in a very simple and optimized way to obtain details 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 PlatformDetail class as follows. Multiple instances are not being created since thanks to a factory constructor it always returns an internal singleton:

import 'package:platform_detail/platform_detail.dart';

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

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

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

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

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

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

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

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

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

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

if (PlatformDetail().isMacOS) {
  print('The current platform is macOS');
}
16
likes
0
points
272
downloads

Publisher

verified publishervictorcarreras.dev

Weekly Downloads

A lightweight library to obtain details of the current platform in a much more complete and simple way.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on platform_detail