showProgress method
Post an in-flight progress notification.
Returns a NotificationProgressController the host uses to
NotificationProgressController.report updates,
NotificationProgressController.complete the task successfully,
or NotificationProgressController.fail with an error. When
cancellable is true, the card renders a cancel affordance
that resolves NotificationProgressController.cancellation.
The progress card persists until the controller terminates — it is exempt from the standard auto-dismiss timer (SPEC §spec:notification-center "Dismissal policy by severity").
Implementation
NotificationProgressController showProgress({
required String message,
bool cancellable = false,
}) {
final id = _mintId();
final notification = WorkbenchNotification(
id: id,
severity: NotificationSeverity.progress,
message: message,
createdAt: _now(),
cancellable: cancellable,
);
_notifications.add(notification);
final controller = NotificationProgressController(
id: id,
service: this,
cancellable: cancellable,
);
_progressControllers[id] = controller;
notifyListeners();
return controller;
}