update method

void update(
  1. String id,
  2. ToastData updater(
    1. ToastData
    )
)

Implementation

void update(String id, ToastData Function(ToastData) updater) {
  final index = _toasts.indexWhere((t) => t.id == id);
  if (index != -1) {
    _toasts[index] = updater(_toasts[index]);
    _notify();
  }
}