bloc_test
library
Classes
MockBloc <E , S >
Extend or mixin this class to mark the implementation as a MockBloc .
MockCubit <S >
Extend or mixin this class to mark the implementation as a MockCubit .
Functions
blocTest <B extends BlocBase<State > , State > (String description , {FutureOr <void > setUp ()?, required B build (), State seed ()?, dynamic act (B bloc )?, Duration ? wait , int skip = 0 , dynamic expect ()?, dynamic verify (B bloc )?, dynamic errors ()?, FutureOr <void > tearDown ()?, dynamic tags })
→ void
Creates a new bloc
-specific test case with the given description
.
blocTest will handle asserting that the bloc
emits the expect
ed
states (in order) after act
is executed.
blocTest also handles ensuring that no additional states are emitted
by closing the bloc
stream before evaluating the expect
ation.
testBloc <B extends BlocBase<State > , State > ({FutureOr <void > setUp ()?, required B build (), State seed ()?, dynamic act (B bloc )?, Duration ? wait , int skip = 0 , dynamic expect ()?, dynamic verify (B bloc )?, dynamic errors ()?, FutureOr <void > tearDown ()? })
→ Future <void >
Internal blocTest runner which is only visible for testing.
This should never be used directly -- please use blocTest instead.
whenListen <State > (BlocBase<State > bloc , Stream <State > stream , {State? initialState })
→ void
Creates a stub response for the listen
method on a bloc
.
Use whenListen if you want to return a canned Stream
of states
for a bloc
instance.