Movatterモバイル変換


[0]ホーム

URL:


menu
  1. Dart
  2. dart:async
  3. StreamTransformer<S,T> class
StreamTransformer
description

StreamTransformer<S,T> classabstractinterface

Transforms a Stream.

When a stream'sStream.transform method is invoked with aStreamTransformer, the stream calls thebind method on the providedtransformer. The resulting stream is then returned from theStream.transform method.

Conceptually, a transformer is simply a function fromStream toStreamthat is encapsulated into a class.

It is good practice to write transformers that can be used multiple times.

All other transforming methods onStream, such asStream.map,Stream.where orStream.expand can be implemented usingStream.transform. AStreamTransformer is thus very powerful but oftenalso a bit more complicated to use.

TheStreamTransformer.fromHandlers constructor allows passing separatecallbacks to react to events, errors, and the end of the stream.TheStreamTransformer.fromBind constructor creates aStreamTransformerwhosebind method is implemented by calling the function passed to theconstructor.

Implementers

Constructors

StreamTransformer(StreamSubscription<T>onListen(Stream<S>stream,boolcancelOnError))
Creates aStreamTransformer based on the givenonListen callback.
const
factory
StreamTransformer.fromBind(Stream<T>bind(Stream<S>))
Creates aStreamTransformer based on abind callback.
factory
StreamTransformer.fromHandlers({voidhandleData(Sdata,EventSink<T>sink)?,voidhandleError(Objecterror,StackTracestackTrace,EventSink<T>sink)?,voidhandleDone(EventSink<T>sink)?})
Creates aStreamTransformer that delegates events to the given functions.
factory

Properties

hashCodeint
The hash code for this object.
no setterinherited
runtimeTypeType
A representation of the runtime type of the object.
no setterinherited

Methods

bind(Stream<S>stream)Stream<T>
Transforms the providedstream.
cast<RS,RT>()StreamTransformer<RS,RT>
Provides aStreamTransformer<RS, RT> view of this stream transformer.
noSuchMethod(Invocationinvocation)→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString()String
A string representation of this object.
inherited

Operators

operator ==(Objectother)bool
The equality operator.
inherited

Static Methods

castFrom<SS,ST,TS,TT>(StreamTransformer<SS,ST>source)StreamTransformer<TS,TT>
Adaptssource to be aStreamTransformer<TS, TT>.
  1. Dart
  2. dart:async
  3. StreamTransformer<S,T> class
dart:async library

[8]ページ先頭

©2009-2025 Movatter.jp