MockApiState<T> class

Mock implementation for API states

Inheritance

Constructors

MockApiState()

Properties

changeHistory List<StateChangeEvent<UiState<T>>>
Get the complete change history
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Whether this state has been disposed and is no longer usable.
no setterinherited
lastChange StateChangeEvent<UiState<T>>?
Get the last change event
no setterinherited
listenerCount int
Get the number of listeners
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value UiState<T>
The current value of the state.
getter/setter pairinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object notifies its listeners.
inherited
clearHistory() → void
Clear the change history
inherited
createSnapshot() StateSnapshot<UiState<T>>
Creates a snapshot of the current state.
inherited
delayGet(Duration delay) → void
Add delay to get operations
inherited
delaySet(Duration delay) → void
Add delay to set operations
inherited
dispose() → void
Disposes of this state and releases any resources.
inherited
equals(UiState<T> other) bool
Checks if the given value is equal to the current state value.
inherited
getValueSetCount(UiState<T> value) int
Get the number of times a specific value was set
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyOnSameValue(bool notify) → void
Configure whether to notify listeners even when value is the same
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies.
inherited
resetMockBehavior() → void
Reset all mock configurations to default
inherited
restoreSnapshot(StateSnapshot<UiState<T>> snapshot) → void
Restores the state from a previously created snapshot.
inherited
setCustomEquals(bool equals(UiState<T>, UiState<T>)) → void
Set custom equality function
inherited
simulateAsyncCall(Future<T> call(), {Duration delay = const Duration(milliseconds: 100)}) Future<void>
Simulate an API call with delay
simulateError(String error) → void
Simulate an API error
simulateLoading() → void
Simulate loading state
simulateSuccess(T data) → void
Simulate a successful API call
throwOnDispose([Exception? exception]) → void
Configure the mock to throw an exception on dispose
inherited
throwOnEquals([Exception? exception]) → void
Configure the mock to throw an exception on equals operations
inherited
throwOnGet([Exception? exception]) → void
Configure the mock to throw an exception on get operations
inherited
throwOnRestore([Exception? exception]) → void
Configure the mock to throw an exception on restore operations
inherited
throwOnSet([Exception? exception]) → void
Configure the mock to throw an exception on set operations
inherited
throwOnSnapshot([Exception? exception]) → void
Configure the mock to throw an exception on snapshot operations
inherited
toString() String
A string representation of this object.
inherited
wasValueSet(UiState<T> value) bool
Check if a specific value was ever set
inherited

Operators

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