Skip to content

Commit 0ae79d2

Browse files
authored
Change back to Object from dynamic (dart-archive/stack_trace#66)
See dart-archive/stack_trace#64 (comment) Enable and fix the lint `avoid_private_typedef_functions`.
1 parent 5fa9c9b commit 0ae79d2

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

pkgs/stack_trace/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## 1.9.4-dev
22

33
* Added support for firefox anonymous stack traces
4+
* Change the argument type to `Chain.capture` from `Function(dynamic, Chain)` to
5+
`Function(Object, Chain)`. Existing functions which take `dynamic` are still
6+
fine, but new uses can have a safer type.
47

58
## 1.9.3
69

pkgs/stack_trace/analysis_options.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ analyzer:
44
implicit-casts: false
55
errors:
66
prefer_spread_collections: ignore
7+
8+
linter:
9+
rules:
10+
- avoid_private_typedef_functions

pkgs/stack_trace/lib/src/chain.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Chain implements StackTrace {
7373
///
7474
/// If [callback] returns a value, it will be returned by [capture] as well.
7575
static T capture<T>(T Function() callback,
76-
{void Function(dynamic error, Chain) onError,
76+
{void Function(Object error, Chain) onError,
7777
bool when = true,
7878
bool errorZone = true}) {
7979
if (!errorZone && onError != null) {

pkgs/stack_trace/lib/src/stack_zone_specification.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ import 'lazy_trace.dart';
1010
import 'trace.dart';
1111
import 'utils.dart';
1212

13-
/// A function that handles errors in the zone wrapped by [Chain.capture].
14-
typedef _ChainHandler = void Function(dynamic error, Chain chain);
15-
1613
/// A class encapsulating the zone specification for a [Chain.capture] zone.
1714
///
1815
/// Until they're materialized and exposed to the user, stack chains are tracked
@@ -56,7 +53,7 @@ class StackZoneSpecification {
5653
///
5754
/// If this is null, that indicates that any unhandled errors should be passed
5855
/// to the parent zone.
59-
final _ChainHandler _onError;
56+
final void Function(Object error, Chain) _onError;
6057

6158
/// The most recent node of the current stack chain.
6259
_Node _currentNode;

0 commit comments

Comments
 (0)