P2PStream<T> class
abstract
Represents a bidirectional channel between two agents in a libp2p network. "agent" is as granular as desired, potentially being a "request -> reply" pair, or whole protocols.
Streams are backed by a multiplexer underneath the hood.
Constructors
Properties
- conn → Conn
-
Returns the connection this stream is part of
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
incoming
→ P2PStream<
Uint8List> -
Returns a Dart Stream of the incoming data
no setter
- isClosed → bool
-
Returns true if the stream is closed
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> - Closes the stream for both reading and writing
-
closeRead(
) → Future< void> - Closes the stream for reading but leaves it open for writing
-
closeWrite(
) → Future< void> - Closes the stream for writing but leaves it open for reading
-
id(
) → String - Returns an identifier that uniquely identifies this Stream within this host, during this run. Stream IDs may repeat across restarts.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
protocol(
) → String - Returns the protocol ID associated with this stream
-
read(
[int? maxLength]) → Future< Uint8List> - Reads data from the stream
-
reset(
) → Future< void> - Closes both ends of the stream
-
scope(
) → StreamManagementScope - Returns the management view of this stream's resource scope
-
setDeadline(
DateTime? time) → Future< void> - Sets a deadline for both reading and writing operations
-
setProtocol(
String id) → Future< void> - Sets the protocol for this stream
-
setReadDeadline(
DateTime time) → Future< void> - Sets a deadline for reading operations
-
setWriteDeadline(
DateTime time) → Future< void> - Sets a deadline for writing operations
-
stat(
) → StreamStats - Returns metadata pertaining to this stream
-
toString(
) → String -
A string representation of this object.
inherited
-
write(
Uint8List data) → Future< void> - Writes data to the stream
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited