loadModel method
Method to load the model.
resources is empty for .glb models and populated for .gltf models.
Implementation
@override
Future<void> loadModel(String modelPath, Map<String, ByteData> resources) async {
// Convert the main model to bytes.
ByteData modelData = await rootBundle.load(modelPath);
Uint8List modelBytes = modelData.buffer.asUint8List();
// Convert the resources map to a sendable form.
final resourceMap = resources.map(
(key, value) => MapEntry(key, value.buffer.asUint8List()),
);
final args = {
'modelBytes': modelBytes,
'name': modelPath.split('/').last,
'resources': resourceMap
};
await _methodChannel.invokeMethod('loadModel', args);
}