showProgress method

Future<void> showProgress(
  1. String title,
  2. double progress, {
  3. double? total,
})

Shows or updates a progress notification.

Implementation

Future<void> showProgress(
  String title,
  double progress, {
  double? total,
}) async {
  final id = 'progress_${title.hashCode}';

  // Update existing if present.
  final existing = _findById(id);
  if (existing != null) {
    existing.progress = progress;
    existing.progressTotal = total;
    _streamController.add(existing);
    return;
  }

  final notification = AppNotification(
    id: id,
    type: NotificationType.progress,
    title: title,
    progress: progress,
    progressTotal: total,
  );
  await show(notification);
}