【问题标题】:BlocProvider.of() called with a context that does not contain a Bloc of type TaharatBloc使用不包含 TaharatBloc 类型的 Bloc 的上下文调用 BlocProvider.of()
【发布时间】:2021-06-10 18:21:21
【问题描述】:

我正在尝试路由我的 TaharatPage,但我遇到了此类错误

在构建 TaharatGeneralPage(dirty) 时抛出了以下断言: 使用不包含 TaharatBloc 类型的 Bloc 的上下文调用 BlocProvider.of()。

    No ancestor could be found starting from the context that was passed to BlocProvider.of<TaharatBloc>().

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    您没有使用生成的路线,而是使用命名导航而不是提供新的 MaterialPageRoute

    【讨论】:

      猜你喜欢
      • 2021-02-08
      • 2020-10-25
      • 2020-05-20
      • 2020-08-21
      • 2020-12-26
      • 2020-10-16
      • 2020-11-15
      • 2020-01-25
      • 2019-09-29
      相关资源
      最近更新 更多