gpuTextureFromAsset function Assets and loading

Future<Texture> gpuTextureFromAsset(
  1. String assetPath
)

Loads an image from the asset bundle at assetPath and uploads it as a Flutter GPU texture.

The asset is decoded with imageFromAsset and then uploaded via gpuTextureFromImage, mipless like that path. Prefer Texture2D.fromAsset for material textures. Throws if the asset is not present in the bundle or cannot be decoded.

Implementation

Future<gpu.Texture> gpuTextureFromAsset(String assetPath) async {
  return await gpuTextureFromImage(await imageFromAsset(assetPath));
}