UndoFn<TUndoState, TResult> typedef

UndoFn<TUndoState, TResult> = FutureOr<TResult> Function(UndoStack<TUndoState> undoStack, Object? reason)

Type signature of a function that is called when the last command call should be undone.

The function is called with the reason why the command was undone and a stack that was passed before to the command's execute method, by that the commands execute method can store state that is needed to undo its last execution.

If reason is not null, the command is being undone because of an Execption in the command function given that undoOnFailure is true. If it is null this function is called by intentionally by calling undo on the command manually. If the function has a return value, it will be assigned to the command's result and value.

Implementation

typedef UndoFn<TUndoState, TResult> = FutureOr<TResult> Function(
  UndoStack<TUndoState> undoStack,
  Object? reason,
);