Skip to content

benyaminbeyzaie/platform_data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
}

About

A package that you can find out the platform type of the user

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published