-
-
Notifications
You must be signed in to change notification settings - Fork 954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProviderContainer weirdly catches and handles unintended errors #1874
Comments
I have actually run into this issue before and I thought I was doing something very wrong. Debugging was very painful without seeing the actual error message. I've used this snippet to get readable error message though stacktrace is still messed up. import 'package:stack_trace/stack_trace.dart';
FlutterError.demangleStackTrace = (StackTrace stack) {
if (stack is Trace) return stack.vmTrace;
if (stack is Chain) return stack.toTrace().vmTrace;
return stack;
}; |
I am unable to access EDIT. Sorry, I didn't know about this, they are both from stack_trace. |
Ah yes, my bad, should've been more specific :) |
I'm seeing this stack trace in my project. This issue only occurs when I use a nested route in GoRoute, for eg: GoRoute(
path: '/home',
builder: (context, state) => const HomePage(),
routes: [
GoRoute(
path: 'recent_contacts',
builder: (context, state) => const RecentContactsPage(),
),
],
), Not sure if OP also has the same route structure since his repo sample is not found now. If I remove Adding |
Describe the bug
I made a mistake on my codebase. Dang, that happens. Specifically, I gave two routes the same name.
I'm using
GoRouter
as a dependency; rightfully, my router will complain about this with a specific runtime exception.The thing is,
ProviderContainer
kicks in, eats this exception and returns something I'm unable to understand.I had to do a scavenge the stack trace to understand where such exception came from.
Here's what I get on my terminal:
some incomprehensible logs
Versus what I should get on my terminal if I hadn't used
ProviderScope
:some useful logs
To Reproduce
I made it! You can reproduce this behavior on this repo. To reproduce, do the following:
flutter run -t lib/main.dart
: you'll get weird errorsflutter run -t lib/main2.dart
: you'll get useful errorsExpected behavior
main.dart
andmain2.dart
should show the same exception, i.e. the readableGoRouter
one, asProviderScope
shouldn't absorb nor modify the nature of this exception, I guess.EDIT. I forgot to push my commits onto the repro, sorry. Now it's updated.
The text was updated successfully, but these errors were encountered: