PersistorDummy<T> class
A dummy persistor.
Constructors
Properties
Methods
-
addError(
Object error, [StackTrace? stackTrace]) → void -
Adds an error to be processed by the store, even if the store was not yet created.
This is useful in methods like readState, which are usually called before the store
exists, and can't show errors to the user by throwing them.
inherited
-
deleteState(
) → Future< void> -
Delete the saved state from the persistence.
override
-
getAndRemoveFirstError(
) → (Object, StackTrace)? -
Gets the first error added by addError (with its stack trace), and removes it.
Returns
nullif there are no errors.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
persistDifference(
{required T? lastPersistedState, required T newState}) → Future< void> -
Save the new state to the persistence.
lastPersistedStateis the last state that was persisted since the app started, whilenewStateis the new state to be persisted.override -
readState(
) → Future< T?> -
Read the saved state from the persistence. Should return null if the state is not yet
persisted. This method should be called only once, when the app starts, before the store
is created. The state it returns may become the store's initial-state. If some error
occurs while loading the info, we have to deal with it by fixing the problem. In the worse
case, if we think the state is corrupted and cannot be fixed, one alternative is deleting
all persisted files and returning null.
override
-
saveInitialState(
T state) → Future< void> -
Save an initial-state to the persistence.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
wrapError(
Object error, StackTrace stackTrace) → Object? -
If any error is thrown by persistDifference, you have the chance to further
process it by using
wrapError. Usually this is used to wrap the error inside of another that better describes the failure. For example, you could turn aFileSystemExceptioninto a UserException, so that it's shown to the user:inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited