BlocProvider.of() called with a context that does not contain a Cubit of type ####.
从字面翻译 可以看到 Cubit 没有context 上下文调用BlocProvider.of()

官方解决

flutter BlocProvider context that does not contain a Cubit of type #### 错误
flutter BlocProvider context that does not contain a Cubit of type #### 错误

flutter BlocProvider context that does not contain a Cubit of type #### 错误

flutter BlocProvider context that does not contain a Cubit of type #### 错误
之后看文档发现少了个返回值。加个return 就好了flutter BlocProvider context that does not contain a Cubit of type #### 错误
如果还是不行的话,可以尝试在子类的外面在套个Builder
flutter BlocProvider context that does not contain a Cubit of type #### 错误
这样的话就能获取到了。
flutter BlocProvider context that does not contain a Cubit of type #### 错误

相关文章:

  • 2021-07-16
  • 2021-12-11
  • 2022-12-23
  • 2021-05-08
  • 2022-12-23
  • 2021-07-02
  • 2022-01-21
  • 2021-08-10
猜你喜欢
  • 2021-09-09
  • 2022-01-13
  • 2021-04-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
相关资源
相似解决方案