问题描述
在下面的代码中,我没有收到任何错误...直到我调试并单击底部导航栏图标以导航到路线。然后该页面会在我的应用栏和底部导航栏之间显示红色错误框。
我收到以下错误:
The following ProviderNotFoundException was thrown building TodaysReviewScreen(dirty):
Error: Could not find the correct Provider<Entries> above this TodaysReviewScreen Widget
This happens because you used a BuildContext that does not include the provider of your choice...
在 main.dart 中,我尝试将 MultiProvider 移到 runApp() 中,用它包装 MaterialApp,在 main_navigation.dart 中,我尝试用它包装 Scaffold。没有运气。
解决方法
已解决:这是一个区分大小写的导入,没有被标记为问题。