flutter_web_plugins library
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:
- How to Write a Flutter Web Plugin, a Medium article
describing how the
url_launcher
package was created usingflutter_web_plugins
.
Classes
- BrowserPlatformLocation
- Delegates to real browser APIs to provide platform location functionality.
- HashUrlStrategy
- This is an implementation of UrlStrategy that uses the browser URL's hash fragments to represent its state.
- 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
- pluginBinaryMessenger → BinaryMessenger
-
A deprecated alias for webPluginRegistrar.
no setter
- urlStrategy ↔ UrlStrategy?
-
Returns the present UrlStrategy for handling the browser URL.
getter/setter pair
- webPluginRegistrar → Registrar
-
The default plugin registrar for the web.
final
- webPluginRegistry → PluginRegistry
-
A deprecated alias for webPluginRegistrar.
no setter
Functions
-
checkBaseHref(
String? baseHref) → String -
Checks that
baseHref
is set. -
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
. -
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)
- Function type that handles pop state events.