Does it support Bloc?
Puspharaj opened this issue · comments
I just need to know, this dynamic widget can support of this format?
onPressed: () { BlocProvider.of<HomeBloc>(context) .add(StartBackgroundLocation()); })
Please let me know is this possible to convert the above. Thanks
No, it only support send a string event, and you can map this string event to your block event.
You can add reference to the click event and handle the events in the DefaultClickListner class.
Even though the way I did it was a bit explicit, I added route:
for navigator click events, snack:
for snackbar cilck events and etc.
Then in the onClicked function write what you want to execute based on the received event.
For your case, the code will probably look like this:
class DefaultClickListener implements ClickListener {
var context;
DefaultClickListener({this.context});
@override
void onClicked(String event) {
print("Receive click event: " + event);
if (event.toLowerCase().contains("bloc:HomeBloc")) {
BlocProvider.of<HomeBloc>(context) .add(StartBackgroundLocation());
}
}
}