WebViewAssetLoader class

Helper class to load local files including application's static assets and resources using http(s):// URLs inside a WebView class. Loading local files using web-like URLs instead of file:// is desirable as it is compatible with the Same-Origin policy.

For more context about application's assets and resources and how to normally access them please refer to Android Developer Docs: App resources overview.

Using http(s):// URLs to access local resources may conflict with a real website. This means that local files should only be hosted on domains your organization owns (at paths reserved for this purpose) or the default domain reserved for this: appassets.androidplatform.net.

Officially Supported Platforms/Implementations:

  • Android native WebView

Constructors

WebViewAssetLoader({String? domain, bool? httpAllowed, List<PlatformPathHandler>? pathHandlers})

Properties

domain String?
Set the domain under which app assets can be accessed. The default domain is appassets.androidplatform.net.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
httpAllowed bool?
Allow using the HTTP scheme in addition to HTTPS. The default is to not allow HTTP.
getter/setter pair
pathHandlers List<PlatformPathHandler>?
List of registered path handlers.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copy() WebViewAssetLoader
Returns a copy of WebViewAssetLoader.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts instance to a map.
toMap() Map<String, dynamic>
Converts instance to a map.
toString() String
A string representation of this object.
override

Operators

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

Static Properties

DEFAULT_DOMAIN String
An unused domain reserved for Android applications to intercept requests for app assets.
final

Static Methods

fromMap(Map<String, dynamic>? map) WebViewAssetLoader?
Gets a possible WebViewAssetLoader instance from a Map value.