Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
io.flutter.plugin.common.EventChannel.StreamHandler Interface Reference

Public Member Functions

void onListen (Object arguments, EventSink events)
 
void onCancel (Object arguments)
 

Detailed Description

Handler of stream setup and teardown requests.

Implementations must be prepared to accept sequences of alternating calls to onListen(Object, EventChannel.EventSink) and onCancel(Object). Implementations should ideally consume no resources when the last such call is not onListen. In typical situations, this means that the implementation should register itself with platform-specific event sources onListen and deregister again onCancel.

Definition at line 129 of file EventChannel.java.

Member Function Documentation

◆ onCancel()

void io.flutter.plugin.common.EventChannel.StreamHandler.onCancel ( Object  arguments)

Handles a request to tear down the most recently created event stream.

Any uncaught exception thrown by this method will be caught by the channel implementation and logged. An error result message will be sent back to Flutter.

The channel implementation may call this method with null arguments to separate a pair of two consecutive set up requests. Such request pairs may occur during Flutter hot restart. Any uncaught exception thrown in this situation will be logged without notifying Flutter.

Parameters
argumentsstream configuration arguments, possibly null.

◆ onListen()

void io.flutter.plugin.common.EventChannel.StreamHandler.onListen ( Object  arguments,
EventSink  events 
)

Handles a request to set up an event stream.

Any uncaught exception thrown by this method will be caught by the channel implementation and logged. An error result message will be sent back to Flutter.

Parameters
argumentsstream configuration arguments, possibly null.
eventsan EventSink for emitting events to the Flutter receiver.

The documentation for this interface was generated from the following file: