showWithStream method
ModProgressController
showWithStream({
- required Stream<
ProgressUpdate> stream, - String? id,
- ModProgressConfig config = const ModProgressConfig(),
- String? title,
- String? subtitle,
- VoidCallback? onComplete,
- void onError(
- String error
- VoidCallback? onClose,
- bool autoCloseOnComplete = false,
- Duration? autoCloseDelay,
Shows a progress overlay that listens to a stream for updates. Useful for gRPC streaming or other async progress sources.
Implementation
ModProgressController showWithStream({
required Stream<ProgressUpdate> stream,
String? id,
ModProgressConfig config = const ModProgressConfig(),
String? title,
String? subtitle,
VoidCallback? onComplete,
void Function(String error)? onError,
VoidCallback? onClose,
bool autoCloseOnComplete = false,
Duration? autoCloseDelay,
}) {
// Generate ID first if not provided
final progressId = id ?? 'progress_$_idCounter';
final controller = show(
id: progressId,
config: config,
title: title,
subtitle: subtitle,
onComplete: () {
onComplete?.call();
if (autoCloseOnComplete) {
if (autoCloseDelay != null) {
Future.delayed(autoCloseDelay, () {
close(progressId);
});
} else {
close(progressId);
}
}
},
onError: onError,
onClose: onClose,
);
controller.connectToStream(stream);
return controller;
}