SseSourceController class final

Implementation of SseSourceControllerBase where the onErrorEvent action can be specified in parameter, allowing configuration of reconnection logic.

If you need to specify a custom object for the stream, use SseParsedSourceController instead.

If you need more precise control prefer implementing SseSourceControllerBase

Inheritance

Constructors

SseSourceController({required String name, required ConnectionStreamBuilder sseStreamBuilder, bool isBroadCast = false, bool doDisposeOnCancel = true, bool doDisposeOnClientExeption = false, dynamic onNewConnection(String name)?, dynamic onConnected(String name)?, dynamic onCloseConnection(String name, bool wasConnected)?, dynamic onCancel(String name, bool wasConnected)?, EventErrorAction? actionOnErrorEvent})
Creates an SseSourceController with the given parameters.

Properties

doDisposeOnCancel bool
Whether to dispose the controller when cancelled.
getter/setter pairinherited
done Future
no setterinherited
eventStreamController StreamController<Map<String, dynamic>>
Internal event stream controller
finalinherited
hashCode int
The hash code for this object.
no setterinherited
hasListener bool
no setterinherited
isClosed bool
no setterinherited
isConnected bool
Returns true if the connection is currently listened to.
no setterinherited
name String
The name of the SSE subscription.
finalinherited
onCancel ↔ dynamic Function(String name, bool wasConnected)?
Callback for when the controller is cancelled.
getter/setter pairinherited
onCloseConnection ↔ dynamic Function(String name, bool wasConnected)?
Callback for when a connection is closed.
getter/setter pairinherited
onConnected ↔ dynamic Function(String name)?
Callback for when a connection is established.
getter/setter pairinherited
onNewConnection ↔ dynamic Function(String name)?
Callback for when a new connection is created.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sink StreamSink<Map<String, dynamic>>
no setterinherited
stream Stream<Map<String, dynamic>>
no setterinherited
wasConnected bool
no setterinherited

Methods

clear() Future<void>
Cancel the current HTTP event stream subscription and close the client.
inherited
closeClient() → void
Closes the HTTP client.
inherited
closeCurrentEventStream() Future<void>
Cancel the current HTTP event stream subscription.
inherited
connectEventListener(ConnectionStreamBuilder sseStreamBuilder) Future<void>
Connects the HTTP event listener using the provided stream builder.
inherited
dispose() Future<void>
Dispose controller. Call clear() and close stream controller. Non of the actions can be done after disposing.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDataEvent(Map<String, dynamic> event) → void
Handles incoming data events.
override
onDoneEvent() → void
Handles stream completion event.
override
onErrorEvent(Object error, StackTrace st) Future<void>
Handles incoming error events.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited