flutter_web_plugins library Null safety

The platform channels and plugin registry implementations for the web implementations of Flutter plugins.

This library provides the Registrar class, which is used in the registerWith method that is itself called by the code generated by the flutter tool for web applications.

See also:

Classes

BrowserPlatformLocation
Delegates to real browser APIs to provide platform location functionality.
HashUrlStrategy
Uses the browser URL's hash fragments to represent its state.
JsUrlStrategy
The JavaScript representation of a URL strategy.
PathUrlStrategy
Uses the browser URL's pathname to represent Flutter's route name.
PlatformLocation
Encapsulates all calls to DOM apis, which allows the UrlStrategy classes to be platform agnostic and testable.
PluginEventChannel<T>
A named channel for sending events to the framework-side using streams.
PluginRegistry
This class was previously separate from Registrar but was merged into it as part of a simplification of the web plugins API.
Registrar
A registrar for Flutter plugins implemented in Dart.
UrlStrategy
Represents and reads route state from the browser's URL.

Properties

jsSetUrlStrategy → _JsSetUrlStrategy
A JavaScript hook to customize the URL strategy of a Flutter app.
@JS('_flutter_web_set_location_strategy')read-only
pluginBinaryMessenger BinaryMessenger
A deprecated alias for webPluginRegistrar.
Deprecated('Use webPluginRegistrar instead. ' 'This feature was deprecated after v1.24.0-7.0.pre.')">@Deprecated('Use webPluginRegistrar instead. ' 'This feature was deprecated after v1.24.0-7.0.pre.')read-only
urlStrategy UrlStrategy?
Returns the present UrlStrategy for handling the browser URL.
read-only
webPluginRegistrar Registrar
The default plugin registrar for the web.
final
webPluginRegistry PluginRegistry
A deprecated alias for webPluginRegistrar.
Deprecated('Use webPluginRegistrar instead. ' 'This feature was deprecated after v1.24.0-7.0.pre.')">@Deprecated('Use webPluginRegistrar instead. ' 'This feature was deprecated after v1.24.0-7.0.pre.')read-only

Functions

checkBaseHref(String? baseHref) String
Checks that baseHref is set.
convertToJsUrlStrategy(UrlStrategy strategy) JsUrlStrategy
Given a Dart implementation of URL strategy, converts it to a JavaScript URL strategy to be passed through JS interop.
ensureLeadingSlash(String path) String
Prepends a forward slash to path if it doesn't start with one already.
extractPathname(String url) String
Extracts the pathname part of a full url.
getBaseElementHrefFromDom() String?
Returns the href attribute of the element in the document.
setUrlStrategy(UrlStrategy? strategy) → void
Change the strategy to use for handling browser URL.
stripTrailingSlash(String path) String
Removes the trailing forward slash from path if any.
usePathUrlStrategy() → void
Use the PathUrlStrategy to handle the browser URL.

Typedefs

EventListener = dynamic Function(Object event)
Signature of an html event listener.