on method

EventEmitterListener on(
  1. String type_update,
  2. FutureOr callback(
    1. UpdateMt update
    ), {
  3. void onError(
    1. Object data
    )?,
})

receive all update data

Implementation

EventEmitterListener on(
    String type_update, FutureOr<dynamic> Function(UpdateMt update) callback,
    {void Function(Object data)? onError}) {
  return event_emitter.on(
    eventName: type_update,
    onCallback: (listener, update) {
      return "";
    },
  );
  // return event_emitter.on(type_update, null, (Event ev, context) async {
  //   try {
  //     if (ev.eventData is MtprotoIsolateReceiveData) {
  //       MtprotoIsolateReceiveData tdlibIsolateReceiveData =
  //           (ev.eventData as MtprotoIsolateReceiveData);
  //       await callback(UpdateMt(
  //         update: tdlibIsolateReceiveData.updateData,
  //         client_id: tdlibIsolateReceiveData.clientId,
  //         client_option: tdlibIsolateReceiveData.clientOption,
  //       ));
  //       return;
  //     }
  //   } catch (e) {
  //     if (onError != null) {
  //       return onError(e);
  //     }
  //   }
  // });
}