FlutterStreamHandler
@protocol FlutterStreamHandler
A strategy for exposing an event stream to the Flutter side.
-
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.
Declaration
Objective-C
- (FlutterError *_Nullable)onListenWithArguments:(id _Nullable)arguments eventSink: (nonnull FlutterEventSink)events;Parameters
argumentsArguments for the stream.
eventsA callback to asynchronously emit events. Invoke the callback with a
FlutterErrorto emit an error event. Invoke the callback withFlutterEndOfEventStreamto indicate that no more events will be emitted. Any other value, includingnilare emitted as successful events.Return Value
A FlutterError instance, if setup fails.
-
Tears down an event stream.
Invoked when the last listener is deregistered from the Stream associated to this channel on the Flutter side.
The channel implementation may call this method with
nilarguments to separate a pair of two consecutive set up requests. Such request pairs may occur during Flutter hot restart.Declaration
Objective-C
- (FlutterError *_Nullable)onCancelWithArguments:(id _Nullable)arguments;Parameters
argumentsArguments for the stream.
Return Value
A FlutterError instance, if teardown fails.
View on GitHub
Install in Dash
FlutterStreamHandler Protocol Reference