UPwa class abstract

Browser and install-state questions, plus the iOS "Add to Home Screen" walkthrough.

iOS has no beforeinstallprompt, so the only way to get a PWA onto an iPhone home screen is to tell the user which buttons to press — that is what promptIosInstall does. Every getter is false off the web.

// Show the install hint once when an iPhone user opens the web app in a browser.
if (UPwa.canPromptIosInstall) UPwa.promptIosInstall();

// Only iPhone Safari (the one that can actually install):
if (UPwa.isIphoneBrowser && UPwa.isIosSafari) UPwa.promptIosInstall();

// Force-show the instructions, e.g. behind a "How to install" button:
UPwa.promptIosInstall(force: true);

// Skip in-app install UI when it is already installed:
if (!UPwa.isStandalone) showInstallBanner();

Constructors

UPwa()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

canPromptIosInstall → bool
True when showing the install walkthrough would make sense: an iOS browser, not yet installed.
no setter
isAndroidBrowser → bool
no setter
isIosBrowser → bool
no setter
isIosSafari → bool
True only for real Safari. Chrome, Firefox, Edge and Opera on iOS are WebKit too but cannot install to the home screen, so they get the "open this in Safari" hint instead.
no setter
isIphoneBrowser → bool
no setter
isStandalone → bool
True when the app was launched from the home screen rather than a browser tab.
no setter

Static Methods

promptIosInstall({bool force = false, String? title, String? step1, String? step2, String? step3, String? safariHint, String? doneLabel}) → Future<void>
Opens a bottom sheet walking the user through "Share → Add to Home Screen".