NyToastRecorder class

A simple recorder that tracks toast notifications shown during tests.

Call NyToastRecorder.setup in your test setUp to start recording, and use expectToastShown to assert on the results.

Example:

setUp(() {
  NyToastRecorder.setup();
});

nyWidgetTest('shows success toast', (tester) async {
  await tester.pumpNyWidget(MyPage());
  // trigger action that shows a toast...
  expectToastShown(id: 'success');
});

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

records List<ToastRecord>
Get all recorded toasts.
no setter

Static Methods

clear() → void
Clear all recorded toasts.
record({String? id, String? title, String? description}) → void
Record a toast notification.
setup() → void
Start recording toast notifications. Call this in setUp.
wasShown({String? id, String? description}) bool
Check if a toast was recorded with the given criteria.