uni_platform 0.1.0 copy "uni_platform: ^0.1.0" to clipboard
uni_platform: ^0.1.0 copied to clipboard

Replaces the Platform class and works on any platform.

uni_platform #

pub version

Replaces the Platform class and works on any platform.


Quick Start #

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  uni_platform: ^0.1.0

Usage #

select method:

import 'package:uni_platform/uni_platform.dart';

String platformType = UniPlatform.select<String>(
  android: 'Android',
  fuchsia: 'Fuchsia',
  iOS: 'iOS',
  linux: 'Linux',
  macOS: 'macOS',
  windows: 'Windows',
  web: 'Web',
  otherwise: 'Unknown',
);

call method:

String platformType = UniPlatform.call<String>(
  android: () => 'Android',
  fuchsia: () => 'Fuchsia',
  iOS: () => 'iOS',
  linux: () => 'Linux',
  macOS: () => 'macOS',
  windows: () => 'Windows',
  web: () => 'Web',
  otherwise: () => 'Unknown',
);

Please see the example app of this plugin for a full example.

License #

MIT

3
likes
0
pub points
79%
popularity

Publisher

verified publisherleanflutter.dev

Replaces the Platform class and works on any platform.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on uni_platform