-
-
Notifications
You must be signed in to change notification settings - Fork 956
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some exceptions causing Flutter asking to demangle stacktraces
fixes #1874
- Loading branch information
1 parent
3fd2e77
commit 594c0b5
Showing
5 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ dev_dependencies: | |
flutter_test: | ||
sdk: flutter | ||
mockito: ^5.0.0 | ||
stack_trace: ^1.11.1 |
30 changes: 30 additions & 0 deletions
30
packages/flutter_riverpod/test/throw_with_stacktrace_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/src/internals.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:stack_trace/stack_trace.dart'; | ||
|
||
void main() { | ||
testWidgets('Flutter does not ask to demangle stacktraces', (tester) async { | ||
final previousErrorHandler = FlutterError.onError; | ||
final stacks = <StackTrace?>[]; | ||
|
||
FlutterError.onError = (details) => stacks.add(details.stack); | ||
await tester.pumpWidget( | ||
MaterialApp( | ||
home: Consumer( | ||
// ignore: invalid_use_of_internal_member | ||
builder: (context, ref, child) => throwErrorWithCombinedStackTrace( | ||
StateError('Hello world'), | ||
StackTrace.current, | ||
), | ||
), | ||
), | ||
); | ||
FlutterError.onError = previousErrorHandler; | ||
|
||
expect( | ||
stacks, | ||
everyElement(isNot(anyOf(isA<Chain>(), isA<Trace>()))), | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters