pwa_info 패키지는 여러 플랫폼에서 점진적 웹 앱(PWA) 환경에 대한 정보를 감지하고 검색하는 유틸리티를 제공합니다. 개발자는 현재 앱이 PWA로 실행 중인지 확인하고, 매니페스트 세부 정보와 같은 PWA 전용 메타데이터에 접근하며, 지원되는 플랫폼에서의 설치 상태를 확인할 수 있습니다. 이는 앱이 브라우저에서 시작되었는지 또는 독립형 PWA로 설치되었는지에 따라 사용자 경험을 맞춤화하는 데 도움이 됩니다. 이 패키지는 Android, iOS, Web, macOS, Windows, Linux를 지원하여 크로스플랫폼 웹 애플리케이션에서 PWA 기능을 강화하려는 목표에 이상적입니다.
사용 사례
PWA 설치 상태 감지
PWA 매니페스트 데이터에 액세스하기
PWA 컨텍스트에 따라 UI 맞춤 설정
오프라인 기능 활성화
크로스 플랫폼 PWA 앱 지원
PWA 기능을 통한 사용자 참여도 향상
주요 기능
크로스 플랫폼 호환성
매니페스트 데이터 검색
설치 상태 감지
간단한 API 통합
모든 주요 플랫폼을 지원합니다
경량이고 효율적
적합한 대상
PWA를 구축하는 개발자
PWA 전용 로직이 필요한 앱
크로스 플랫폼 웹 애플리케이션
다중 OS 환경을 대상으로 하는 프로젝트
웹 및 모바일용으로 플러터를 사용하는 팀
고려 사항
웹 플랫폼 지원이 필요합니다
PWA 전용 검사에 한정
런타임 구성 옵션이 없음
브라우저 PWA API에 의존
네이티브 전용 앱에는 적합하지 않습니다
모든 내장 웹뷰 시나리오에서 작동하지 않을 수 있습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
pwa_info
A Flutter package for detecting device and browser information in Progressive Web Apps (PWAs).
Features
OS detection — identify iOS, Android, or other platforms
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 systemprint(info.os); // DeviceOS.ios, DeviceOS.android, or DeviceOS.other// Browserprint(info.browser); // BrowserName.chrome, BrowserName.safari, etc.// User agent stringprint(info.userAgent); // "Mozilla/5.0 (iPhone; CPU iPhone OS ..."// Mobile checkprint(info.isMobile); // true or false// PWA standalone checkprint(info.isStandalone); // true if running in standalone mode// Get everything at oncefinal 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.