downloadModel method
Asks the OS / browser to download the model, reporting progress.
The stream completes when the model is ready or the download failed.
Implementation
@override
Stream<ModelDownloadStatus> downloadModel() {
return downloadEventChannel
.receiveBroadcastStream()
.map((data) {
if (data is Map) {
return ModelDownloadStatus.fromMap(Map<String, dynamic>.from(data));
}
return const ModelDownloadStatus(
status: ModelFeatureStatus.downloading,
);
})
.handleError((Object e) {
if (e is PlatformException) throw mapPlatformException(e);
throw e;
});
}