gpuTextureFromAsset function

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. 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));
}