https://github.com/rexios80/platform_plus
Platform Plus is a package for easily figuring out information about the platform your code is running on
https://github.com/rexios80/platform_plus
Last synced: 28 days ago
JSON representation
Platform Plus is a package for easily figuring out information about the platform your code is running on
- Host: GitHub
- URL: https://github.com/rexios80/platform_plus
- Owner: Rexios80
- License: bsd-3-clause
- Created: 2021-06-27T23:37:09.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-12T18:53:01.000Z (7 months ago)
- Last Synced: 2025-05-08T05:56:48.549Z (28 days ago)
- Language: Dart
- Homepage: https://pub.dev/packages/platform_plus
- Size: 271 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Platform Plus is a package for easily figuring out information about the platform your code is running on
## Features
| Property | Use-case |
| ------------------ | --------------------------------------------------- |
| isAndroidNative | Android native |
| isAndroidWeb | Android browser |
| isIOSNative | iOS native |
| isIOSWeb | iOS browser |
| isWindowsNative | Windows native |
| isWindowsWeb | Windows browser |
| isMacOSNative | macOS native |
| isMacOSWeb | macOS browser |
| isLinuxNative | Linux native |
| isLinuxWeb | Linux browser |
| isFuschiaNative | Fuschia native |
| isFuschiaWeb | Fuschia browser (currently unsupported) |
| supportsFirebase | Web or Android native or iOS native or macOS native |
| isUnitTest | Running with `flutter test` |
| isPhysicalDevice | Running on a physical device (not an emulator) |
| androidVersionCode | Android SDK version (see AndroidVersionCode) |
| iosVersion | iOS version |
| iosDevice | The iOS device (see IOSDevice) |
| isTestFlight | If the app was installed from TestFlight |
| webRenderer | The current web renderer |## Usage
```dart
import 'package:platform_plus/platform_plus.dart';void example() async {
await PlatformPlus.platform.init();if (PlatformPlus.platform.isAndroidNative) {
// Do something
} else if (PlatformPlus.platform.isAndroidWeb) {
// Do something else
}if (PlatformPlus.platform.isPhysicalDevice) {
// Do something
}if (PlatformPlus.platform.isUnitTest) {
// Do something
}final androidVersionCode = PlatformPlus.platform.androidVersionCode;
if ((androidVersionCode ?? -1) >= AndroidVersionCode.s) {
// Do something
}final iosVersion = PlatformPlus.platform.iosVersion;
if ((iosVersion ?? -1) >= 13) {
// Do something
}final iosDevice = PlatformPlus.platform.iosDevice;
if (iosDevice == IOSDevice.iPhone) {
// Do something
}final webRenderer = PlatformPlus.platform.webRenderer;
if (webRenderer == WebRenderer.wasm) {
// Do something
}
}```