EventStreamDecoder class
A stream transformer that converts a string stream into a stream of ServerSentEvents
Note: Typically, you would use EventSource instead of using this class directly.
Expects each string to represent one line. This means any input stream must first be split into lines before beeing passed to this transformer. It will consume multiple lines to generate SSE events from the data.
A typical usage would be to use for example the StreamedResponse
from the
http
package and transform it in multiple steps like this:
StreamedResponse response = // ...
final sseStream = response.stream
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform(const EventStreamDecoder());
- Implemented types
Constructors
- EventStreamDecoder.new()
-
Default constructor
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
bind(
Stream< String> stream) → Stream<ServerSentEvent> -
Transforms the provided
stream
.override -
cast<
RS, RT> () → StreamTransformer< RS, RT> -
Provides a
StreamTransformer<RS, RT>
view of this stream transformer.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited