Skip to content

Commit 9ea2d22

Browse files
committed
v9.0.2: Fix deprecation of ExecuteInsteadHandler and ifRestrictedExecuteInstead
Properly deprecated ExecuteInsteadHandler typedef and ifRestrictedExecuteInstead parameters instead of breaking renames. Both old and new names now work during v9.x with deprecation warnings. Changes: - Added deprecated ExecuteInsteadHandler typedef pointing to RunInsteadHandler - Updated all 12 factory methods to accept both old and new parameter names - Updated all command constructors to support both parameters - Added assertions to prevent both parameters being provided simultaneously - Added comprehensive test coverage for all deprecated variants (19 tests) - Updated fix_data.yaml with note about typedef migration - Added file-level ignore for deprecated_member_use_from_same_package Migration: Users can run `dart fix --apply` to auto-migrate to new parameter names.
1 parent e126b85 commit 9ea2d22

11 files changed

+580
-49
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
[9.0.2] - 2025-11-15
2+
3+
### Fixes
4+
5+
- **Properly deprecated ExecuteInsteadHandler and ifRestrictedExecuteInstead**: Added proper deprecation instead of breaking renames. Both old (`ExecuteInsteadHandler`, `ifRestrictedExecuteInstead`) and new (`RunInsteadHandler`, `ifRestrictedRunInstead`) names now work during v9.x. Added comprehensive tests for deprecated variants to maintain coverage. Updated fix_data.yaml to auto-migrate users via `dart fix`.
6+
17
[9.0.1] - 2025-11-14
28

39
### Fixes

lib/async_command.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ class CommandAsync<TParam, TResult> extends Command<TParam, TResult> {
99
Future<TResult> Function()? funcNoParam,
1010
required super.initialValue,
1111
required super.restriction,
12+
required super.ifRestrictedRunInstead,
13+
@Deprecated(
14+
'Use ifRestrictedRunInstead instead. '
15+
'This will be removed in v10.0.0. '
16+
'See BREAKING_CHANGE_EXECUTE_TO_RUN.md for migration guide.',
17+
)
1218
required super.ifRestrictedExecuteInstead,
1319
required super.includeLastResultInCommandResults,
1420
required super.noReturnValue,

lib/command_it.dart

Lines changed: 192 additions & 43 deletions
Large diffs are not rendered by default.

lib/fix_data.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
# Usage: dart fix --apply
44
#
55
# See: https://github.com/flutter/flutter/blob/master/docs/contributing/Data-driven-Fixes.md
6+
#
7+
# Note: Typedef renames (ExecuteInsteadHandler → RunInsteadHandler) cannot be
8+
# automatically fixed by dart fix. The @Deprecated annotation will guide users
9+
# to use the new RunInsteadHandler type. Parameter renames will be auto-fixed.
610

711
version: 1
812
transforms:

lib/mock_command.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ class MockCommand<TParam, TResult> extends Command<TParam, TResult> {
1818
super.noParamValue = false,
1919
super.noReturnValue = false,
2020
super.restriction,
21+
super.ifRestrictedRunInstead,
22+
@Deprecated(
23+
'Use ifRestrictedRunInstead instead. '
24+
'This will be removed in v10.0.0. '
25+
'See BREAKING_CHANGE_EXECUTE_TO_RUN.md for migration guide.',
26+
)
2127
super.ifRestrictedExecuteInstead,
2228
super.includeLastResultInCommandResults = false,
2329
super.errorFilter,

lib/sync_command.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ class CommandSync<TParam, TResult> extends Command<TParam, TResult> {
1515
TResult Function()? funcNoParam,
1616
required super.initialValue,
1717
required super.restriction,
18+
required super.ifRestrictedRunInstead,
19+
@Deprecated(
20+
'Use ifRestrictedRunInstead instead. '
21+
'This will be removed in v10.0.0. '
22+
'See BREAKING_CHANGE_EXECUTE_TO_RUN.md for migration guide.',
23+
)
1824
required super.ifRestrictedExecuteInstead,
1925
required super.includeLastResultInCommandResults,
2026
required super.noReturnValue,

lib/undoable_command.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ class UndoableCommand<TParam, TResult, TUndoState>
5555
required UndoFn<TUndoState, TResult> undo,
5656
required super.initialValue,
5757
required super.restriction,
58+
required super.ifRestrictedRunInstead,
59+
@Deprecated(
60+
'Use ifRestrictedRunInstead instead. '
61+
'This will be removed in v10.0.0. '
62+
'See BREAKING_CHANGE_EXECUTE_TO_RUN.md for migration guide.',
63+
)
5864
required super.ifRestrictedExecuteInstead,
5965
required bool undoOnExecutionFailure,
6066
required super.includeLastResultInCommandResults,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: command_it
22
description: command_it is a way to manage your state based on `ValueListenable` and the `Command` design pattern. It is a rebranding of flutter_command.
3-
version: 9.0.1
3+
version: 9.0.2
44
homepage: https://github.com/flutter-it/command_it
55

66
screenshots:

0 commit comments

Comments
 (0)