Keyboard Shortcuts

j / kScroll down / up
ggScroll to top
GScroll to bottom
K / /Open search
?Show this help
EscClose search / help
n / NNext / previous section
hGo to landing
dGo to docs
:Command mode — type section name

Press ? or Esc to close

Systems

Toast System

Toasts are a global overlay driven by ToastCubit, a singleton. Any layer can push a toast; the UI renders them in one place at the app root.

Pushing a toast

lib/features/toast/logic/toast_cubit.dart
sl<ToastCubit>().show(
  message: context.l10n.t(TranslationKeys.commonSaved),
  type: ToastType.success,
);

State

The cubit holds a list of active toasts, each with a type, message, and auto-dismiss timer. ToastOverlay animates them in and out.

lib/features/toast/logic/toast_cubit.dart
enum ToastType { info, success, warning, error }

class ToastCubit extends Cubit<ToastState> {
  void show({required String message, ToastType type = ToastType.info}) {
    final item = ToastItem(id: _uuid(), message: message, type: type);
    emit(state.add(item));
    Future.delayed(const Duration(seconds: 3), () => dismiss(item.id));
  }

  void dismiss(String id) => emit(state.remove(id));
}

Rendering

ToastOverlay is mounted once in app.dart, above the shell. It positions toasts (top or bottom) and fades them.

lib/features/toast/presentation/widgets/toast_overlay.dart
BlocBuilder<ToastCubit, ToastState>(
  builder: (context, state) => Stack(
    children: state.items.map((t) => _ToastCard(item: t)).toList(),
  ),
)

Toast vs global error

ToastGlobalErrorCubit
TriggerAny layer, explicitlyErrorInterceptor automatically
Use for"Saved", "Copied"Network / server failures
DedupeNoYes, by error code
sam's arch — A Pragmatic Flutter Architecture