WebUtils class

Helper providing access to features having different implementations in browser and on native platforms.

Constructors

WebUtils()

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

hasPwa bool
Indicator whether this device has a PWA installed.
getter/setter pair
isFirefox bool
Indicates whether device's browser is Firefox or not.
no setter
isFocused bool
Indicates whether device's browser is in focus.
no setter
isFullscreen bool
Indicates whether device's browser is in fullscreen mode or not.
no setter
isLocked FutureOr<bool>
Indicates whether the protect is currently locked.
no setter
isMacOS bool
Indicates whether device's OS is macOS or iOS.
no setter
isPopup bool
Indicates whether the current window is a popup.
no setter
isSafari bool
Indicates whether device's browser is Safari or not.
no setter
onBroadcastMessage Stream
Returns a stream broadcasting the browser's broadcast channel changes.
no setter
onFocusChanged Stream<bool>
Returns a stream broadcasting the device's browser focus changes.
no setter
onFullscreenChange Stream<bool>
Returns a stream broadcasting the fullscreen changes.
no setter
onSelectNotification ↔ void Function(NotificationResponse)?
Callback, called when user taps onto a notification.
getter/setter pair
onStorageChange Stream<WebStorageEvent>
Returns a stream broadcasting the browser's storage changes.
no setter
onWindowFocus Stream<bool>
Returns a stream broadcasting the browser's window focus changes.
no setter
userAgent Future<String>
Returns the User-Agent header to put in the network queries.
no setter

Static Methods

bindKey(HotKey key, bool handler()) Future<void>
Binds the handler to be invoked on the key presses.
cameraPermission() Future<StreamSubscription<void>>
Requests the permission to use a camera and holds it until unsubscribed.
cleanIndexedDb({String? except}) Future<void>
Does nothing as IndexedDB is absent on desktop or mobile platforms.
cleanStorage() → void
Clears the browser's storage.
closeWindow() → void
Closes the current window.
consoleError(Object? object) → void
Prints a string representation of the provided object to the console as an error.
containsCall(ChatId chatId) bool
Indicates whether the browser's storage contains a call identified by the provided chatId.
containsCalls() bool
Indicates whether the browser's storage contains any calls.
deleteLoader() → void
Deletes the loader element.
downloadFile(String url, String name) Future<void>
Downloads the file from the provided url.
getCall(ChatId chatId) WebStoredCall?
Returns a call identified by the provided chatId from the browser's storage.
getCallRect(ChatId chatId) Rect?
Returns the Rect stored by the provided chatId, if any.
getCredentials(UserId userId) Credentials?
Returns the stored in browser's storage Credentials identified by the provided UserId, if any.
microphonePermission() Future<StreamSubscription<void>>
Requests the permission to use a microphone and holds it until unsubscribed.
moveCall(ChatId chatId, ChatId newChatId, {WebStoredCall? newState}) → void
Moves a call identified by its chatId to the newChatId replacing its stored state with an optional newState.
onPanic(void cb(String)?) → void
Sets callback to be fired whenever Rust code panics.
openPopupCall(ChatId chatId, {bool withAudio = true, bool withVideo = false, bool withScreen = false}) bool
Opens a new popup window at the Routes.call page with the provided chatId.
pingCall(ChatId chatId) → void
Ensures a call in the provided chatId is considered active the browser's storage.
play(String asset) Future<void>
Plays the provided asset.
protect<T>(Future<T> callback(), {bool exclusive = true, String tag = 'mutex'}) Future<T>
Guarantees the callback is invoked synchronously, only by single tab or code block at the same time.
putCredentials(Credentials creds) → void
Puts the provided Credentials to the browser's storage.
refresh() Future<void>
Refreshes the current browser's page.
registerScheme() Future<void>
Registers the custom Config.scheme.
removeAllCalls() → void
Removes all calls from the browser's storage, if any.
removeCall(ChatId chatId) → void
Removes a call identified by the provided chatId from the browser's storage.
removeCredentials(UserId userId) → void
Removes Credentials identified by the provided UserId from the browser's storage.
replaceState(String from, String to) → void
Replaces the provided from with the specified to in the current URL.
setAlertFavicon() → void
Sets the favicon being used to an alert style.
setCall(WebStoredCall call) → void
Stores the provided call in the browser's storage.
setCallRect(ChatId chatId, Rect prefs) → void
Sets the prefs as the provided call's popup window preferences.
setDefaultFavicon() → void
Sets the favicon being used to the default style.
setPathUrlStrategy() → void
Sets the URL strategy of your web app to using paths instead of a leading hash (#).
showNotification(String title, {String? dir, String? body, String? lang, String? tag, String? icon}) Future<void>
Shows a notification via "Notification API" of the browser.
title(String title) → void
Pushes title to browser's window title.
toggleFullscreen(bool enable) bool
Toggles browser's fullscreen to enable, and returns the resulting fullscreen state.
unbindKey(HotKey key, bool handler()) Future<void>
Unbinds the handler from the key.