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
-
- Object
- StreamSourceController<
Map< String, dynamic> > - SseSourceControllerBase<
Map< String, dynamic> > - SseSourceController
Constructors
- SseSourceController({required String name, required ConnectionStreamBuilder sseStreamBuilder, bool isBroadCast = false, bool doDisposeOnCancel = true, bool doDisposeOnClientException = 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
-
A future which is completed when the stream controller is done
sending events.
no setterinherited
-
eventStreamController
→ StreamController<
Map< String, dynamic> > -
Internal event stream controller
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListener → bool
-
Whether there is a subscriber on the Stream.
no setterinherited
- isClosed → bool
-
Whether the stream controller is closed for adding more events.
no setterinherited
- isConnected → bool
-
Returns true if the connection is currently listened to.
no setterinherited
- isPaused → bool
-
Whether the subscription would need to buffer events.
no setterinherited
- name → String
-
The name of the SSE subscription.
finalinherited
- onCancel ↔ FutureOr Function()?
-
The callback which is called when the stream is canceled.
getter/setter pairinherited
- onCancelConnection ↔ 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
- onListen ↔ void Function()?
-
The callback which is called when the stream is listened to.
getter/setter pairinherited
- onNewConnection ↔ dynamic Function(String name)?
-
Callback for when a new connection is created.
getter/setter pairinherited
- onPause ↔ void Function()?
-
The callback which is called when the stream is paused.
getter/setter pairinherited
- onResume ↔ void Function()?
-
The callback which is called when the stream is resumed.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sink
→ StreamSink<
Map< String, dynamic> > -
Returns a view of this object that only exposes the StreamSink interface.
no setterinherited
-
stream
→ Stream<
Map< String, dynamic> > -
The stream that this controller is controlling.
no setterinherited
- wasConnected → bool
-
no setterinherited
Methods
-
add(
Map< String, dynamic> event) → void -
Sends a data
event.inherited -
addError(
Object error, [StackTrace? stackTrace]) → void -
Sends or enqueues an error event.
inherited
-
addStream(
Stream< Map< source, {bool? cancelOnError}) → FutureString, dynamic> > -
Receives events from
sourceand puts them into this controller's stream.inherited -
clear(
) → Future< void> -
Cancel the current HTTP event stream subscription and close the client.
inherited
-
close(
) → Future -
Closes the stream.
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 stacktrace) → 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