Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这行代码的含义是什么:
CounterBloc counterBloc=BlocProvider.of<CounterBloc>(context);
“ .of(context) ”在飞镖语言中是什么意思?
这是BlocProvider类使用的方法。在这种情况下,它将使用 Provider 或 Inhered WidgetsBuildContext context在 Widget 树中搜索它的祖先以找到上面公开的匹配项。CounterBloc
BlocProvider
BuildContext context
CounterBloc
阅读有关 Inhered Widgets 或 Provider 包的信息。