如何实现 Flutter Provider 5.0.0 以将数据从其他一些子屏幕传递到带有底部标签栏的主屏幕

时间:2021-04-14 12:46:57

标签: flutter dart flutter-dependencies flutter-web

我有 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.

如何实施此任何帮助将不胜感激 提前致谢

0 个答案:

没有答案
相关问题