Skip to content

Commit a0f83c3

Browse files
authored
Deprecate isCastError (flutter#133)
For consistency with the SDK, and in anticipation of all `is*Error` matchers being deprecated in some future release, eagerly deprecate `isCastError`.
1 parent af4fe7d commit a0f83c3

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/src/error_matchers.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import 'type_matcher.dart';
88
const isArgumentError = TypeMatcher<ArgumentError>();
99

1010
/// A matcher for [CastError].
11+
@Deprecated('CastError has been deprecated in favor of TypeError. '
12+
'Use `isA<TypeError>()` or, if you need compatibility with older SDKs, '
13+
'use `isA<CastError>()` and ignore the deprecation.')
1114
const isCastError = TypeMatcher<CastError>();
1215

1316
/// A matcher for [ConcurrentModificationError].

test/type_matcher_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ void main() {
1111
_test(isMap, {}, name: 'Map');
1212
_test(isList, [], name: 'List');
1313
_test(isArgumentError, ArgumentError());
14+
// ignore: deprecated_member_use, deprecated_member_use_from_same_package
1415
_test(isCastError, CastError());
1516
_test<Exception>(isException, const FormatException());
1617
_test(isFormatException, const FormatException());

0 commit comments

Comments
 (0)