TextureLoader class

Class for loading a texture. This uses the ImageLoader internally for loading files.

final texture = await TextureLoader().fromAsset('textures/land_ocean_ice_cloud_2048.jpg' ); 
// immediately use the texture for material creation 

final material = MeshBasicMaterial({ MaterialProperty.map:texture});
Inheritance

Constructors

TextureLoader.new({LoadingManager? manager, bool flipY = false})

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<Texture?>
asset - path of the file to be loaded
override
fromBlob(Blob blob) Future<Texture?>
blob - a blob of the file to be loaded
override
fromBytes(Uint8List bytes) Future<Texture?>
bytes - the loaded bytes of the file
override
fromFile(File file) Future<Texture?>
file - the file to be loaded
override
fromNetwork(Uri uri) Future<Texture?>
uri - a uri containing the location of the file to be loaded
override
fromPath(String filePath) Future<Texture?>
filePath - path of the file to be loaded
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setCrossOrigin(String crossOrigin) TextureLoader
crossOrigin — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
override
setPath(String path) TextureLoader
path — Set the base path for the asset.
override
setRequestHeader(Map<String, dynamic> requestHeader) TextureLoader
requestHeader - key: The name of the header whose value is to be set. value: The value to set as the body of the header.
override
setResourcePath(String? resourcePath) TextureLoader
resourcePath — Set the base path for dependent resources like textures.
override
setWithCredentials(bool value) TextureLoader
Whether the XMLHttpRequest uses credentials such as cookies, authorization headers or TLS client certificates. See XMLHttpRequest.withCredentials.
override
toString() String
A string representation of this object.
inherited
unknown(dynamic url) Future<Texture?>
If the type of format is unknown load it here.
override

Operators

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