FileLoader class
A low level class for loading resources with Fetch, used internally by most loaders. It can also be used directly to load any file type that does not have a loader.
Note: The cache must be enabled using
Cache.enabled = true;
This is a global property and only needs to be set once to be used by all
loaders that use FileLoader internally. Cache is a cache
module that holds the response from each request made through this loader,
so each file is requested once.
Constructors
- FileLoader.new([LoadingManager? manager])
Properties
- crossOrigin ↔ String
-
getter/setter pairinherited
- flipY ↔ bool
-
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- manager ↔ LoadingManager
-
getter/setter pairinherited
- mimeType ↔ String
-
getter/setter pairinherited
- path ↔ String
-
getter/setter pairinherited
-
requestHeader
↔ Map<
String, dynamic> -
getter/setter pairinherited
- resourcePath ↔ String?
-
getter/setter pairinherited
- responseType ↔ String
-
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- withCredentials ↔ bool
-
getter/setter pairinherited
Methods
-
dispose(
) → void -
inherited
-
fromAsset(
String asset, {String? package}) → Future< ThreeFile?> -
asset
- path of the file to be loadedoverride -
fromBlob(
Blob blob) → Future< ThreeFile> -
blob
- a blob of the file to be loadedoverride -
fromBytes(
Uint8List bytes, [String? type, String? location]) → Future< ThreeFile> -
bytes
- the loaded bytes of the fileoverride -
fromFile(
File file) → Future< ThreeFile> -
file
- the file to be loadedoverride -
fromNetwork(
Uri uri) → Future< ThreeFile?> -
uri
- a uri containing the location of the file to be loadedoverride -
fromPath(
String filePath) → Future< ThreeFile?> -
filePath
- path of the file to be loadedoverride -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setCrossOrigin(
String crossOrigin) → Loader -
crossOrigin
— The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.inherited -
setMimeType(
String value) → FileLoader -
Set the expected
mimeType
of the file being loaded. Note that in many cases this will be
determined automatically, so by default it is
null
. -
setPath(
String path) → Loader -
path
— Set the base path for the asset.inherited -
setRequestHeader(
Map< String, dynamic> requestHeader) → Loader -
requestHeader
- key: The name of the header whose value is to be set. value: The value to set as the body of the header.inherited -
setResourcePath(
String? resourcePath) → Loader -
resourcePath
— Set the base path for dependent resources like textures.inherited -
setResponseType(
String value) → FileLoader - Change the response type. Valid values are:
-
setWithCredentials(
bool value) → Loader -
Whether the XMLHttpRequest uses credentials such as cookies, authorization
headers or TLS client certificates. See
XMLHttpRequest.withCredentials.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
unknown(
dynamic url) → Future< ThreeFile?> -
url
- a dynmaic data that gets parsed by the systemoverride
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited