Listener constructor Null safety

  1. String eventName,
  2. Object? context,
  3. EventCallback callback,
  4. CancelEvent? _cancelCallback

Constructor for Listener. This will take four arguments. eventName, callback are mandatory. context, _cancelCallback are optional. if _cancelCallback callback is provided, then the listener can use that to cancel the subscription.


Listener(this.eventName, this.context, this.callback, this._cancelCallback);