Make FlutterErrorDetails.exception non-nullable as documented (#67364)
This commit is contained in:
committed by
GitHub
parent
1271447bbe
commit
8998167d0f
@@ -28,7 +28,7 @@ Future<void> main() async {
|
||||
|
||||
completer.future.then(
|
||||
(String value) {},
|
||||
onError: (dynamic error, StackTrace stack) {
|
||||
onError: (Object error, StackTrace stack) {
|
||||
assert(stack is stack_trace.Chain);
|
||||
FlutterError.reportError(FlutterErrorDetails(
|
||||
exception: error,
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
Future<void> main(FutureOr<void> testMain()) async {
|
||||
reportTestException = (FlutterErrorDetails details, String testDescription) {
|
||||
expect(details.exception, isA<StateError>());
|
||||
expect(details.exception.message, 'foo');
|
||||
expect((details.exception as StateError).message, 'foo');
|
||||
expect(testDescription, 'custom exception reporter');
|
||||
};
|
||||
|
||||
|
||||
@@ -737,7 +737,7 @@ void main() {
|
||||
}, () {});
|
||||
|
||||
expect(flutterErrorDetails.exception, isA<AssertionError>());
|
||||
expect(flutterErrorDetails.exception!.message, 'A Timer is still pending even after the widget tree was disposed.');
|
||||
expect((flutterErrorDetails.exception as AssertionError).message, 'A Timer is still pending even after the widget tree was disposed.');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user