Last updated:
0 purchases
platform data
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());
}
copied to clipboard
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
}
copied to clipboard
if (isPlatformWeb) {
// build for web
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.