搜尋套件、儲存庫與 APP 分類

套件詳情v1.2.0

pwa_info

PWA 資訊套件

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
85
喜歡數
2
Pub 分數
150

安裝套件

flutter pub add pwa_info

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

pwa_info 套件提供工具,可在多個平台檢測並取得關於漸進式 Web 應用程式(PWA)環境的資訊。它讓開發者能夠檢查目前應用是否以 PWA 形式執行,存取 PWA 專屬的元資料(例如清單詳細資料),並判斷在支援平台上的安裝狀態。這有助於根據應用是從瀏覽器啟動還是作為獨立 PWA 安裝來客製化使用者體驗。此套件支援 Android、iOS、Web、macOS、Windows 與 Linux,非常適合追求增強 PWA 功能的跨平台 Web 應用。

適用情境

  • 檢測 PWA 安裝狀態
  • 存取 PWA 清單資料
  • 根據 PWA 環境自訂 UI
  • 啟用離線功能
  • 支援跨平台 PWA 應用
  • 透過PWA功能提升使用者參與度

主要特色

  • 跨平台相容性
  • 取得清單資料
  • 安裝狀態檢測
  • 簡單 API 結合
  • 支援所有主要平台
  • 輕量且高效

適合對象

  • 開發 PWA 的開發者
  • 需要PWA特定邏輯的應用程式
  • 跨平台網頁應用
  • 針對多個作業系統環境的專案
  • 使用 Flutter 進行網頁和移動開發的團隊

使用建議

  • 需要網路平台支援
  • 僅限 PWA 特定檢查
  • 無執行時配置選項
  • 依賴瀏覽器 PWA API
  • 不適用於僅原生應用
  • 在所有嵌入式 WebView 場景中可能無法正常運作

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

pwa_info

A Flutter package for detecting device and browser information in Progressive Web Apps (PWAs).

pub package License

Features

  • OS detection — identify iOS, Android, or other platforms
  • Browser detection — detect Chrome, Safari, Firefox, Edge, Opera, Samsung Internet
  • Mobile check — determine if the device is mobile
  • PWA standalone mode — check if running as a standalone PWA
  • User agent — access the raw user agent string

Installation

Add pwa_info to your pubspec.yaml:

dependencies:
  pwa_info: ^1.2.0

Then run:

flutter pub get

Usage

import 'package:pwa_info/pwa_info.dart';

final info = PwaInfo();

// Operating system
print(info.os); // DeviceOS.ios, DeviceOS.android, or DeviceOS.other

// Browser
print(info.browser); // BrowserName.chrome, BrowserName.safari, etc.

// User agent string
print(info.userAgent); // "Mozilla/5.0 (iPhone; CPU iPhone OS ..."

// Mobile check
print(info.isMobile); // true or false

// PWA standalone check
print(info.isStandalone); // true if running in standalone mode

// Get everything at once
final result = info.all;
print(result);

API

PwaInfo
Member Type Description
os DeviceOS Detected operating system
browser BrowserName Detected browser
userAgent String Raw user agent string (lowercased)
isWeb bool Whether running on web (kIsWeb)
isMobile bool Whether the device is mobile
isStandalone bool Whether running in PWA standalone mode
all PwaInfoResult All properties as a single object
DeviceOS
Value Description
ios iPhone or iPad
android Android device
other Desktop or unknown
BrowserName
Value Description
chrome Google Chrome
safari Apple Safari
firefox Mozilla Firefox
edge Microsoft Edge
opera Opera
samsungInternet Samsung Internet Browser
unknown Unrecognized browser

Example

See the example directory for a complete Flutter web app.

License

This project is licensed under the BSD 3-Clause License — see the LICENSE file for details.

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。