fromAsset static method
Future<Texture2D>
fromAsset(
- String assetPath, {
- TextureContent content = TextureContent.color,
- TextureSampling sampling = const TextureSampling(),
- AssetBundle? bundle,
Loads, decodes, and uploads the image asset at assetPath.
Implementation
static Future<Texture2D> fromAsset(
String assetPath, {
TextureContent content = TextureContent.color,
TextureSampling sampling = const TextureSampling(),
AssetBundle? bundle,
}) async {
final image = await imageFromAsset(assetPath, bundle: bundle);
try {
return await fromImage(image, content: content, sampling: sampling);
} finally {
image.dispose();
}
}