subscribeToEventOnce function Null safety

int subscribeToEventOnce(
  1. String eventName,
  2. dynamic callback(
    1. Event
    )
)

Implementation

int subscribeToEventOnce(String eventName, Function(Event) callback) {
  int evtId = 0;
  evtId = subscribeToEvent(eventName, (Event evt){
    if(simpleEvents[eventName]!.length > evtId) simpleEvents[eventName]?.removeAt(evtId);
    callback(evt);
  });
  return evtId;
}