搜索插件、代码仓与 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 项

源码仓库

使用此插件的项目

暂无相关数据。