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

Flutter specified platform data, A cleaner way to know users platform type.

Flutter specified platform data, A cleaner way to know users platform type.

Getting started #

Don't forget to initialize the class at first like that:

void main() {
  PlatformData.init();
  // You can get the platform type like this:
  print('platform type: ' + PlatformData.platformType.toString());
  runApp(MyApp());
}

Usage #

After initializing the package you can use it anywhere in the code in two ways:

if (PlatformData.platformType == PlatformType.web) {
    // build for web
} else if (PlatformData.platformType == PlatformType.android) {
    // build for android
}
if (isPlatformWeb) {
    // build for web
}
1
likes
110
pub points
0%
popularity

Publisher

unverified uploader

Flutter specified platform data, A cleaner way to know users platform type.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on platform_data