AssetsPathHandler class
Handler class to open a file from assets directory in the application APK.
Opens the requested file from the application's assets directory.
The matched prefix path used shouldn't be a prefix of a real web path.
Thus, if the requested file cannot be found a WebResourceResponse object with a null
data will be returned instead of null
.
This saves the time of falling back to network and trying to resolve a path that doesn't exist.
A WebResourceResponse with null
data will be received as an HTTP response with status code 404
and no body.
The MIME type for the file will be determined from the file's extension using
guessContentTypeFromName.
Developers should ensure that asset files are named using standard file extensions.
If the file does not have a recognised extension, text/plain
will be used by default.
- Inheritance
-
- Object
- PathHandler
- AssetsPathHandler
Constructors
- AssetsPathHandler({required String path})
Properties
Methods
-
handle(
String path) → Future< WebResourceResponse?> -
Handles the requested URL by returning the appropriate response.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Converts instance to a map.
override
-
toMap(
) → Map< String, dynamic> -
Converts instance to a map.
override
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromMap(
Map< String, dynamic> ? map) → AssetsPathHandler? - Gets a possible AssetsPathHandler instance from a Map value.