on method

EventEmitterListener on(
  1. String type_update,
  2. FutureOr callback(
    1. UpdateBot updateBot
    )
)

example:

tg.on(tg.event_update, (update) async {
   print(update);
});

add this for handle update api

Implementation

EventEmitterListener on(String type_update,
    FutureOr<dynamic> Function(UpdateBot updateBot) callback) {
  return event_emitter.on(type_update, null, (Event ev, context) async {
    try {
      if (ev.eventData is UpdateBot) {
        UpdateBot updateApi = ev.eventData as UpdateBot;
        await callback(updateApi);
        return;
      }
    } catch (e) {}
  });
}