loadAsset method
Loads an asset as bytes from the given path
The path should be relative to the assets directory Example: 'models/demo.bin' or 'assets/models/demo.bin'
Throws:
AssetNotFoundExceptionif asset doesn't exist- Exception for other loading errors
Implementation
@override
Future<Uint8List> loadAsset(String path) async {
// Used as the desktop fallback in AssetSourceHandler when
// large_file_handler has no plugin implementation (#250 Mode 2).
// rootBundle.load() works on all platforms including macOS / Windows /
// Linux desktop. Loads the whole asset into memory — fine for the small
// models that are typically bundled (large models go through
// copyAssetToFile which streams via large_file_handler).
final byteData = await rootBundle.load(path);
return byteData.buffer.asUint8List(
byteData.offsetInBytes,
byteData.lengthInBytes,
);
}