Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leanflutter/uni_platform
Replaces the Platform class and works on any platform.
https://github.com/leanflutter/uni_platform
Last synced: 4 days ago
JSON representation
Replaces the Platform class and works on any platform.
- Host: GitHub
- URL: https://github.com/leanflutter/uni_platform
- Owner: leanflutter
- License: mit
- Created: 2024-01-18T14:56:41.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-03-02T03:14:10.000Z (9 months ago)
- Last Synced: 2024-03-25T21:42:10.603Z (8 months ago)
- Language: Dart
- Homepage:
- Size: 252 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# uni_platform
[![pub version][pub-image]][pub-url] [![][discord-image]][discord-url]
[pub-image]: https://img.shields.io/pub/v/uni_platform.svg
[pub-url]: https://pub.dev/packages/uni_platform
[discord-image]: https://img.shields.io/discord/884679008049037342.svg
[discord-url]: https://discord.gg/zPa6EZ2jqbSubstitutes the Platform class, ensuring works across all platforms.
---
- [Quick Start](#quick-start)
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)## Quick Start
### Installation
Add this to your package's pubspec.yaml file:
```yaml
dependencies:
uni_platform: ^0.1.1
```### Usage
select method:
```dart
import 'package:uni_platform/uni_platform.dart';String platformType = UniPlatform.select(
android: 'Android',
fuchsia: 'Fuchsia',
ios: 'iOS',
linux: 'Linux',
macos: 'macOS',
windows: 'Windows',
web: 'Web',
otherwise: 'Unknown',
);
```call method:
```dart
String platformType = UniPlatform.call(
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](./LICENSE)