emit method
void
emit({
- required String event,
- dynamic data,
- void onResponse(
- dynamic response
- void onError(
- dynamic response
Implementation
void emit({
required String event,
dynamic data,
void Function(dynamic response)? onResponse,
void Function(dynamic error)? onError,
}) {
interceptors.onSend(event, data);
final polling = _polling;
if (polling == null || !polling.isConnected) {
onError?.call('Socket is not initialized');
return;
}
try {
polling.emit(event, data, onResponse: onResponse);
} catch (e) {
interceptors.onError(event, e);
onError?.call(e);
}
}