of static method
Method that allows widgets to access a Bloc
or Cubit
instance
as long as their BuildContext
contains a BlocProvider
instance.
If we want to access an instance of BlocA
which was provided higher up
in the widget tree we can do so via:
BlocProvider.of<BlocA>(context);
Implementation
static RemoteValueThemeData of(BuildContext context) {
try {
return context.watch<_ThemeCubit>().state;
} catch (err) {
return const RemoteValueThemeData();
}
}