resource_bloc_test library

Tools for testing resource blocs.

Properties

isEmptyLoadingState ↔ Matcher
A matcher that matches a resource state that is loading and all other properties (key, value, source, error) are null.
getter/setter pair
isEmptyNonLoadingState ↔ Matcher
A matcher that matches a resource state that is not loading and all other properties (key, value, source, error) are null.
getter/setter pair

Functions

isDoneWithValue(Object? value, Source source, {Object? key, Object? error}) → Matcher
Convenience matcher that matches a resource state that is not loading, with the given value & source.
isInitialLoadingState([Object? key]) → Matcher
A matcher that matches a resource state that is loading, where the key matches the given key matcher, and value & error are null
isInitialNonLoadingState([Object? key]) → Matcher
A matcher that matches a resource state that is not loading, where the key matches the given key matcher, and value & error are null
isKeyErrorState(Object error) → Matcher
A matcher that matches a resource state after a key error, where the key is null, there is no value, and the error matches the given error matcher
isLoadingStateWith({Object? key, Object? value, Object? error, Source? source}) → Matcher
Matcher that matches a resource state that is loading.
isLoadingWithValue(Object? value, Source source, {Object? key, Object? error}) → Matcher
Convenience matcher that matches a resource state that is loading, with the given value and source.
isNonLoadingStateWith({Object? key, Object? value, Object? error, Source? source}) → Matcher
Matcher that matches a resource state that is not loading.
isSnapshotOf<V>({bool? isLoading, Object? value, Object? error, Source? source}) → Matcher
Matcher that matches a StateSnapshot that is strictly of the provided generic value type.
isStateOf<K extends Object, V>({bool? isLoading, Object? key, Object? value, Object? error, Source? source}) → Matcher
Matcher that matches a ResourceState that is strictly of the provided generic key and value types.
isStateWith({bool? isLoading, Object? key, Object? value, Object? error, Source? source}) → Matcher
Matcher that matches a ResourceState or StateSnapshot whose properties match all of the provided matchers.
untilDoneLoading(BaseResourceBloc<Object, dynamic> bloc) FutureOr<void>
Returns a future that finishes when the bloc is done loading (i.e. isLoading turns false).
untilState<K extends Object, V>(BaseResourceBloc<K, V> bloc, UntilCondition<K, V> condition) FutureOr<void>
Returns a future that finishes when the bloc's state passes the condition check.

Typedefs

UntilCondition<K extends Object, V> = bool Function(ResourceState<K, V> state)