FLUTTER ECOSYSTEM

gskinnerTeam/flutter-universal-platform

dart.io.Platform의 웹 안전 구현입니다. 실행 시 오류인 "Unsupported operation: Platform._operatingSystem"을 방지하는 데 도움이 됩니다.

flutter-universal-platform 프로젝트 이미지
Stars
111
Forks
30
최근 푸시(UTC)
2024. 5. 23.
프로젝트 상태
활성
gskinner team GitHub avatar
GITHUB Organization

gskinner team ↗

We collaborate with smart, motivated clients to conceptualize, design, and build world-class interactive experiences.

Edmonton, Canada공식 웹사이트 ↗
언어Dart

이 저장소가 배포한 패키지

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

Universal Platform - A Web-safe Platform class

pub package

Currently, if you include the dart.io.Platform anywhere in your code, your app will throw the following error on Web:

Unsupported operation: Platform._operatingSystem

With this plugin you can perform platform detection on all platforms, including Web, without errors.

🔨 Installation

dependencies:
  universal_platform: ^1.0.0+1
⚙ Import

Remove any usages of dart.io.Platform, and replace with this:

import 'package:universal_platform/universal_platform.dart';

🕹️ Usage

This acts as a drop-in replacement for dart.io.Platform, with a different name for improved clarity.

//This will explode on Web
bool isIos = Platform.isIOS;

//This will not :)
bool isIos = UniversalPlatform.isIOS;
bool isWeb = UniversalPlatform.isWeb;

🐞 Bugs/Requests

If you encounter any problems feel open an issue. If you feel the library is missing a feature, please raise a ticket on Github and we'll look into it. Pull request are also welcome.

📃 License

MIT License