installWithProgress abstract method
Installs the model with progress tracking
Returns a stream of progress percentages (0-100)
Parameters:
source
: The model source to install fromcancelToken
: Optional token for cancelling the installation
Note: Some sources may not support true progress:
- AssetSource: simulates progress (copy is instant)
- BundledSource: returns 100 immediately (no download)
- FileSource: returns 100 immediately (just registration)
Example:
final cancelToken = CancelToken();
try {
await for (final progress in handler.installWithProgress(
source,
cancelToken: cancelToken,
)) {
print('Progress: $progress%');
}
} catch (e) {
if (CancelToken.isCancel(e)) {
print('Installation cancelled');
}
}
Throws:
- DownloadCancelledException if cancelled via cancelToken
Implementation
Stream<int> installWithProgress(
ModelSource source, {
CancelToken? cancelToken,
});