我想在initState方法中从数据库中获取一个值。因此,我尝试通过使用Provider.of(context)方法调用函数来访问值。但是,我得到了以下错误:
E/flutter ( 6424): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Error: Could not find the correct Provider<RestaurantTimings> above this MyApp Widget
E/flutter ( 6424):
E/flutter ( 6424): This
您好,我正面临一个问题,我的flutter应用程序使用提供商和消费者。 当我在调试器中遇到这个问题时,一切都很正常: ════════ Exception caught by foundation library ════════════════════════════════
The following assertion was thrown while dispatching notifications for CatergoryProvider:
setState() or markNeedsBuild() called during build.
This _InheritedP
我们已经在TDD方法中启动了一个关于颤振的新项目。我正在使用国家管理的提供者。在编写Widget测试时,我们面临着测试提供者的问题。请您用一个例子建议编写提供者和小部件注入提供程序的单元测试。
我得到了以下问题
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════
The following ProviderNotFoundException was thrown running a test:
Error: Could not find the correct Provider
此屏幕是一个抽屉屏幕,它接受身份验证块,以便为用户提供信息并使其能够注销。尽管我使用的是正确的提供商,但我还是收到了这个错误 The following ProviderNotFoundError was thrown building Pets4allDrawer(dirty):
I/flutter (32011): Error: Could not find the correct Provider<AuthService> above this Pets4allDrawer Widget
I/flutter (32011): To fix, please:
I/flutte
我仍然对状态管理技术犹豫不决,对何时和为什么使用Provider.of<X>和Consumer<X>感到有点困惑。我从中了解到(我认为),当我们想要访问数据时,当您在这两者之间选择时,您将使用Provider.of,但是您不需要更改UI。因此,以下内容(从文档中获取)可以访问数据并更新新事件的UI:
return HumongousWidget(
// ...
child: AnotherMonstrousWidget(// <- This widget will rebuild on new data events
// ...
chil
我在flutter中创建了一个搜索栏,在这样做的时候,我发现了上面的错误。它正在显示icon != null。我不明白为什么它会显示出来!谁能告诉我怎么解决这个问题。它显示以下错误: ════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown building Consumer<PatientDataNotifier>(dirty, dependencies: [_Inh
我正在推动一个新的Route在我的画廊文件到细节文件与一个Hero动画。一切都很好,但是当我在details文件中调用pop()返回到图片库时,我有一个Provider错误:
flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following ProviderNotFoundException was thrown building GalleryThumbnail(dirty, state:
fl
我正在开发一个微小的待办事项列表应用程序,我是新的Provider软件包。我知道这个错误:
错误:无法在此Builder之上找到正确的提供程序。这是因为您使用的“BuildContext”不包括您选择的提供者。
When the exception was thrown, this was the stack:
#0 Provider._inheritedElementOf (package:provider/src/provider.dart:332:7)
#1 Provider.of (package:provider/src/provider.dart:284:3