EventRecorder class
Grava eventos disparados no EventBus durante testes.
Uso:
final recorder = EventRecorder.fresh();
recorder.listenFor<MyEvent>();
MyEventBus.fire(MyEvent(...));
await Future.delayed(Duration(milliseconds: 50));
expect(recorder.eventsOf<MyEvent>().length, 1);
recorder.dispose();
Object Calisthenics:
- Uma única variável de instância (Regra 8)
- Coleção de primeira classe via
_channels(Regra 4)
Constructors
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
-
clear(
) → void - Apaga todos os eventos gravados sem cancelar os listeners.
-
dispose(
) → void - Cancela todos os listeners e limpa o estado interno.
-
eventsOf<
E> () → RecordedEventList< E> -
Retorna os eventos gravados do tipo
E. -
listenFor<
E> ({EventBus? eventBus}) → void -
Inicia a gravação de eventos do tipo
E. -
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