How can I pass a bloc object to a widget as a parameter like this:
I want to be able to pass either one bloc (TimerBloc) or another bloc (AnotherBloc) into this class and use that to return the BlocBuilder with that bloc.
Like either this: TimerField(bloc: TimerBloc) or this: TimerField(bloc:AnotherBloc)
class TimerField extends StatelessWidget {
final [Not sure of the class] bloc;
const TimerField({
Key key,
@required this.bloc,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return BlocBuilder<[THE BLOC THAT WAS PASSED IN], [AND THE STATE]>(
.......