subscribe<Event> method
void
subscribe<Event>(
- void handler(
- Event event
- bool handleError = true,
- ErrorCallback? onError,
安全订阅事件,自动管理生命周期
Implementation
void subscribe<Event>(
void Function(Event event) handler, {
bool handleError = true,
ErrorCallback? onError,
}) {
_eventSubscriptions.add(
EventBusUtils.on<Event>(
handler,
handleError: handleError,
onError: onError,
),
);
}