/// <summary> /// Sets up an event stream and begin emitting events. /// Invoked when the first listener is registered with the Stream associated to this channel on the Flutter side. /// </summary> /// <param name="arguments">Arguments for the stream.</param> /// <param name="events"> /// A callback to asynchronously emit events. /// Invoke the callback with a <see cref="FlutterError"/> to emit an error event. /// Invoke the callback with <see cref="ConstantsEx.FlutterEndOfEventStream"/> to indicate that no more events will be emitted. /// Any other value, including null, are emitted as successful events. /// </param> /// <returns>A <see cref="FlutterError"/> instance, if setup fails.</returns> public FlutterError OnListen(NSObject arguments, FlutterEventSink events) { _events = events; return(null); }
/// <summary> /// Tears down an event stream. /// Invoked when the last listener is deregistered from the Stream associated to this channel on the Flutter side. /// </summary> /// <param name="arguments">Arguments for the stream.</param> /// <returns>A <see cref="FlutterError"/> instance, if teardown fails.</returns> public FlutterError OnCancel(NSObject arguments) { _events = null; return(null); }