パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v5.0.0

platform_info

ビルドモードやオペレーティングシステムなどの現在のプラットフォームに関する情報を含みます。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
3.1万
いいね数
111
Pub ポイント
160

パッケージをインストール

flutter pub add platform_info

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

platform_info パッケージは、ビルドモード(デバッグ、リリース、プロファイル)やオペレーティングシステムを含む、現在の実行環境に関する詳細情報を簡単に取得できるようにします。このパッケージは、プラットフォーム固有の特性に基づいてコードを条件付きで実行する必要がある開発者向けに設計されています。Android、iOS、Web、macOS、Windows、Linux のすべての主要プラットフォームをサポートしており、ランタイムでのプラットフォーム認識が必要なクロスプラットフォームアプリケーションに最適です。複雑なロジックやネイティブコードを必要とせずに、プラットフォームの詳細を検出するための軽量かつシンプルな API を提供しています。

用途

  • ビルドモードに基づく条件論理
  • 実行時におけるオペレーティングシステムの検出
  • クロスプラットフォームアプリカスタマイズ
  • ランタイムプラットフォームの診断
  • プラットフォーム別の機能フラグ
  • プラットフォーム固有の問題のデバッグ

主な機能

  • すべての主要プラットフォームをサポートしています
  • ビルドモードの検出を提供します
  • シンプルで直感的な API
  • 軽量で依存関係なし
  • リアルタイムプラットフォーム情報
  • ネイティブコードは不要です

適している対象

  • クロスプラットフォームのFlutterアプリ
  • ビルドモードのチェックが必要なアプリ
  • 複数のOSをターゲットとする開発者
  • テストとデバッグのシナリオ
  • プラットフォーム固有の機能を備えたアプリ

注意事項

  • ハードウェアレベルの詳細情報を提供しない
  • 基本的なプラットフォームおよびビルド情報に限定
  • 高度なデバイス検出には適していません
  • エッジケースの手動処理が必要です
  • 初期化後の実行時更新なし
  • 特定のデバイスモデルに対応していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

platform_info

platform_info Checkout Coverage License: MIT Linter GitHub stars

About

Cross-platform io/html package. Works on the web, mobile phones, desktops and console. Fully caches itself on first initialization.

Easy to use, just add to pubspec.yaml as dependency and then import: import 'package:platform_info/platform_info.dart';

Platform is a singleton, and the default way to access an instance of Platform is to call static getters: Platform.instance or Platform.I or platform

Usage

Example of using the library to get the current platform info

Platform Information

Provides platform information such as:

  • Build mode

    • release
    • profile
    • debug
  • Host platform type

    • vm (io, desktops, mobile, console, server)
    • js (web, html, browser)
  • Operating system

    • Fuchsia
    • Linux
    • MacOS
    • Windows
    • iOS
    • Android
    • Unknown
  • Version (unknown if not available)

  • Locale string (en if not available)

  • The number of individual execution units of the machine (0 if not available)

  • Operating system is a known type

  • Is a Web-based applications

  • Is a VM supporting for non-web applications

  • Is a mobile device (Android, iOS)

  • Is a desktop device (Windows, macOS, Fuchsia)

  • Is Material design device (Android, Fuchsia)

  • Is Cupertino design device (macOS, iOS)

  • is Linux

  • is macOS

  • is Windows

  • is android

  • is iOS

  • is fuchsia

  • when method allowing to compose a complex condition

Pattern matching

Run functions that satisfy the current state of the platform. You can use nested methods to compose more complex queries.

Operating System

[fuchsia] - whether the operating system is a version of Fuchsia [windows] - whether the operating system is a version of Windows [android] - whether the operating system is a version of Android [iOS] - whether the operating system is a version of iOS [macOS] - whether the operating system is a version of MacOS [linux] - whether the operating system is a version of Linux [unknown] - operating system unknown

Design

[material] - is material (Android, Fuchsia) [cupertino] - is cupertino (macOS, iOS)

Mobile or desktop

[mobile] - is mobile device (Android, iOS) [desktop] - is desktop device (Windows, MacOS, Fuchsia)

VM (IO) or JS (Web)

[js] - is web-based applications [vm] - is I/O supporting for non-web applications

Build mode

[release] - release build mode [profile] - profile build mode [debug] - debug build mode [orElse] - any callback was not called

Sequence of checks
  1. Operating System
  2. Design
  3. Mobile/Desktop
  4. VM/JS
  5. Build mode
  6. Call [orElse] if any callback was not called

Coverage

Changelog

Refer to the Changelog to get all release notes.

Maintainers

Plague Fox

Funding

If you want to support the development of our library, there are several ways you can do it:

We appreciate any form of support, whether it's a financial donation or just a star on GitHub. It helps us to continue developing and improving our library. Thank you for your support!

License

MIT

Tags

cross, platform, info

カテゴリー

依存関係

依存関係一覧 2 件

ソースリポジトリ

このパッケージを使用しているプロジェクト