Skip to content

Commit d58de85

Browse files
committed
Release v9.1.0: Add global errors stream
New Features: - Added Command.globalErrors stream for reactive error monitoring - Stream emits all globally-routed command errors - Perfect for analytics, crash reporting, and UI notifications - watch_it integration with registerStreamHandler Improvements: - Renamed ErrorHandler* classes to *ErrorFilter pattern - Deprecated old names (removed in v10.0.0) - Added deprecated_member_use_from_same_package: ignore to analysis_options.yaml - Removed old docsite folder (docs now at flutter-it.dev) Tests: - Added tests for new ErrorFilter classes - Added comprehensive tests for globalErrors stream - All 36 tests passing Documentation: - Updated global_configuration.md with globalErrors section - Updated error_handling.md with stream examples - Updated README.md with link to stream docs
1 parent 9ea2d22 commit d58de85

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1235
-24634
lines changed

BREAKING_CHANGE_EXECUTE_TO_RUN.md

Lines changed: 760 additions & 0 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,71 @@
1+
[9.1.0] - 2025-11-21
2+
3+
### New Features
4+
5+
- **Global errors stream**: Added `Command.globalErrors` stream that emits all command errors across the entire application. This provides a centralized way to observe, log, and respond to command errors without polling individual commands.
6+
7+
**Key capabilities:**
8+
- **Reactive error monitoring**: Stream emits `CommandError<dynamic>` for every globally-routed error
9+
- **Production-focused**: Emits for ErrorFilter-routed errors and error handler exceptions, does NOT emit debug-only `reportAllExceptions`
10+
- **Use cases**: Centralized logging, analytics/monitoring, crash reporting, global UI notifications (error toasts)
11+
- **watch_it integration**: Perfect for `registerStreamHandler` to show error toasts in root widget
12+
13+
**Example - Global error toast with watch_it:**
14+
```dart
15+
class MyApp extends WatchingWidget {
16+
@override
17+
Widget build(BuildContext context) {
18+
registerStreamHandler<Stream<CommandError>, CommandError>(
19+
target: Command.globalErrors,
20+
handler: (context, snapshot, cancel) {
21+
if (snapshot.hasData) {
22+
final error = snapshot.data!;
23+
ScaffoldMessenger.of(context).showSnackBar(
24+
SnackBar(content: Text('Error: ${error.error}')),
25+
);
26+
}
27+
},
28+
);
29+
return MaterialApp(...);
30+
}
31+
}
32+
```
33+
34+
**Stream behavior:**
35+
- ✅ Emits when `ErrorFilter` routes error to global handler
36+
- ✅ Emits when error handler itself throws (if `reportErrorHandlerExceptionsToGlobalHandler` enabled)
37+
- ❌ Does NOT emit for `reportAllExceptions` (debug-only feature)
38+
- Multiple listeners supported (broadcast stream)
39+
- Cannot be closed
40+
41+
[9.0.3] - TBD
42+
43+
### Improvements
44+
45+
- **Improved ErrorFilter class naming consistency**: Renamed `ErrorHandler*` classes to simpler `*ErrorFilter` pattern to better align with existing filters. Old names remain functional with deprecation warnings until v10.0.0.
46+
47+
**Class name changes:**
48+
- `ErrorHandlerGlobalIfNoLocal``GlobalErrorFilter` (deprecated)
49+
- `ErrorHandlerLocal``LocalErrorFilter` (deprecated)
50+
- `ErrorHandlerLocalAndGlobal``LocalAndGlobalErrorFilter` (deprecated)
51+
52+
**Why this change:**
53+
- Better naming consistency: matches `TableErrorFilter` and `PredicatesErrorFilter` pattern
54+
- Simpler and clearer: `LocalErrorFilter` vs `LocalHandlingFilter`
55+
- All filter implementations now end with `*ErrorFilter`
56+
57+
**Migration:**
58+
No action required - old names still work with deprecation warnings. Update at your convenience:
59+
```dart
60+
// Old (still works)
61+
Command.errorFilterDefault = const ErrorHandlerGlobalIfNoLocal();
62+
errorFilter: const ErrorHandlerLocal()
63+
64+
// New
65+
Command.errorFilterDefault = const GlobalErrorFilter();
66+
errorFilter: const LocalErrorFilter()
67+
```
68+
169
[9.0.2] - 2025-11-15
270

371
### Fixes

README.md

Lines changed: 155 additions & 532 deletions
Large diffs are not rendered by default.

analysis_options.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ analyzer:
77
- example/**
88
- example_command_results/**
99
- counter_example/**
10+
errors:
11+
deprecated_member_use_from_same_package: ignore
1012

1113
linter:
1214
rules:

docsite/.gitignore

Lines changed: 0 additions & 20 deletions
This file was deleted.

docsite/README.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

docsite/babel.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

docsite/docs/command_builder.md

Lines changed: 0 additions & 80 deletions
This file was deleted.

docsite/docs/command_details/command.md

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)