createModel method
Create a model from model data located at the modelPath.
See ModelLoader
Implementation
Future<Model> createModel(final String modelPath) async {
final completer = Completer<Model>();
if (_supportsFFI()) {
unawaited(
compute(_loadModel, modelPath).then(
(final modelPointer) => completer.complete(
Model(modelPath, _channel, Pointer.fromAddress(modelPointer)),
),
onError: completer.completeError,
),
);
} else if (Platform.isAndroid || Platform.isIOS) {
_pendingModels[modelPath] = completer;
await _channel.invokeMethod('model.create', modelPath);
}
return completer.future;
}