我有 2 个底部 Tabbar 导航,从第二个 Tabbar 转到另一个页面,如果我单击一个按钮,然后我必须将数据发送到主屏幕,即使用 Provider 的第一个 Tabbar 中的页面,但正在获取
Error: Could not find the correct Provider<ServiceReportProvider> above this ReportDetail Widget
This happens because you used a `BuildContext` that does not include the provider
of your choice. There are a few common scenarios:
- You added a new provider in your `main.dart` and performed a hot-reload.
To fix, perform a hot-restart.
- The provider you are trying to read is in a different route.
Providers are "scoped". So if you insert of provider inside a route, then
other routes will not be able to access that provider.
- You used a `BuildContext` that is an ancestor of the provider you are trying to read.
Make sure that ReportDetail is under your MultiProvider/Provider<ServiceReportProvider>.
This usually happens when you are creating a provider and trying to read it immediately.
如何实施此任何帮助将不胜感激 提前致谢