loadAsset method
Loads texture from asset path.
Implementation
Future<void> loadAsset(String assetPath) async {
final data = await rootBundle.load(assetPath);
final codec = await ui.instantiateImageCodec(data.buffer.asUint8List());
final frame = await codec.getNextFrame();
_image = frame.image;
_width = _image!.width;
_height = _image!.height;
_loaded = true;
}