enqueue method

Future<void> enqueue(
  1. Toasted toast
)

Enqueues a Toasted toast. Returns a future that completes the toast is removed from the queue either after it transitions out or when the queue is cleared.

Implementation

Future<void> enqueue(Toasted toast) {
  final onDequeued = _onToastDequeued(toast);

  _queue.add(toast);
  if (_state == ToastedState.none) {
    _next();
  }

  return onDequeued;
}