You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Corrected createAsync signature:
- func is positional parameter (before {)
- initialValue is required named parameter
Corrected createUndoable signature:
- Return type is Command<TParam, TResult>, not UndoableCommand
- func is positional parameter
- initialValue is required named parameter (comes before undo)
- undo is required named parameter
- undoOnExecutionFailure comes after required params
All parameters now match actual source code signatures.
Verified against: command_it.dart lines 1373-1389 and 1635-1653
-**`func`** - The async function to wrap. Takes a parameter of type `TParam` and returns `Future<TResult>`
88
-
-**`initialValue`** - The command's initial value before first execution. Required for commands with return values because commands are `ValueListenable<TResult>` and need a value immediately. **Not available for void commands** (see NoResult variants below)
87
+
-**`func`** - The async function to wrap (positional parameter). Takes a parameter of type `TParam` and returns `Future<TResult>`
88
+
-**`initialValue`** - The command's initial value before first execution (required named parameter). Commands are `ValueListenable<TResult>` and need a value immediately. **Not available for void commands** (see NoResult variants below)
89
89
90
90
**Optional parameters:**
91
91
@@ -133,26 +133,28 @@ Undoable commands extend async commands with undo capability. They maintain an `
-**`func`** - Your async function that receives **TWO parameters**: the command parameter (`TParam`) AND the undo stack (`UndoStack<TUndoState>`) where you push state snapshots (positional parameter)
152
154
153
-
-**`func`** - Your async function that receives **TWO parameters**: the command parameter (`TParam`) AND the undo stack (`UndoStack<TUndoState>`) where you push state snapshots
155
+
-**`initialValue`** - The command's initial value before first execution (required named parameter)
154
156
155
-
-**`undo`** - Handler function called to perform the undo operation:
157
+
-**`undo`** - Handler function called to perform the undo operation (required named parameter):
Pop state from the stack and restore it. Called when user manually undos or when `undoOnExecutionFailure: true` and execution fails
163
165
164
-
-**`undoOnExecutionFailure`** - When `true`, automatically calls the undo handler and restores state if the command fails. Perfect for optimistic updates that need rollback on error
166
+
**Optional parameters:**
167
+
168
+
-**`undoOnExecutionFailure`** - When `true` (default), automatically calls the undo handler and restores state if the command fails. Perfect for optimistic updates that need rollback on error
0 commit comments