Closed mikhael28 closed 1 year ago
Where is the code that's throwing the error? Is it in feedbackBuilder
or in your regular app code?
If it's the former, this is a bug on your end-the feedback builder is built at the top of the widget tree so your providers aren't accessible from that part of the tree. You need to put your providers above BetterFeedback
or find some other approach.
If it's the latter, sounds like a bug in the package. If so I'm going to be poking around and submitting some PRs for bugs I'm hitting, I can try to diagnose yours while I'm at it.
I actually found a way to resolve this - essentially, the central appStateManager had a different context object than the other Notifiers that were being registered in a higher level Provider - this, for some reason, caused the BetterFeedback to wig out. However, when I had the other notifiers share the same context as the central app state manager, it resolved itself. I guess Flutter could only handle so many high level inconsistent contexts
Version
2.6.0
Library
feedback
Flutter channel
master
Flutter version
3.8 or 9, the alpha build
Platform
Android, iOS, Web
Details
When loading Dialogs, or using context to find a particular Provider - I will get this error: ` flutter: [ERROR] Error: Could not find the correct Provider above this StatefulBuilder Widget
This happens because you used a 'BuildContext' that does not include the provider
of your choice. There are a few common scenarios:
main.dart
and performed a hot-reload. To fix, perform a hot-restart.BuildContext
that is an ancestor of the provider you are trying to read. Make sure that StatefulBuilder is under your MultiProvider/ProviderIt seems that the Feedback widget that is wrapping the application is hijacking context, to the point where using deeply nested widgets using a shared context are breaking. Now, I am honestly not sure - is this a bug/issue with the package, or am I just writing bad Flutter code? I am inclined to believe the latter - while I have a stable app in production, I am not sure I am using the
context
object in the best way. Does anyone have any feedback on this issue, or have any recommended reading on the more advanced parts of using thecontext
object and what some of the pitfalls are?Steps to reproduce
Output of
flutter doctor -v
No response