Context class

Context class for network operations

Constructors

Context({Duration? timeout})
Creates a new Context

Properties

done → Future<void>
Future that completes when the context is done
no setter
hashCode → int
The hash code for this object.
no setterinherited
isDone → bool
Whether the context is done
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancel([Object? reason]) → void
Cancel the context
getAllowLimitedConn() → (bool, String)
Gets the allow limited connection option from the Context
getDialCancel() → Future<void>?
Gets the dial cancel signal from the Context, if any.
getDialPeerTimeout() → Duration
Gets the dial peer timeout from the Context
getForceDirectDial() → (bool, String)
Gets the force direct dial option from the Context
getForceFreshDial() → (bool, String)
Gets the force fresh dial option from the Context
getNoDial() → (bool, String)
Gets the no dial option from the Context
getSimultaneousConnect() → (bool, bool, String)
Gets the simultaneous connect option from the Context
getUseTransient() → (bool, String)
Gets the use transient option from the Context
getValue(Object key) → Object?
Gets a value from the Context
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
withAllowLimitedConn(String reason) → Context
Creates a new Context with the allow limited connection option
withDialCancel(Future<void> cancel) → Context
Creates a new Context whose dial stops when cancel completes. Transports that support it (UDX) stop sending at once; the Happy Eyeballs dialer uses it to stop the dials that lost the race.
withDialPeerTimeout(Duration timeout) → Context
Creates a new Context with the dial peer timeout
withForceDirectDial(String reason) → Context
Creates a new Context with the force direct dial option
withForceFreshDial(String reason) → Context
Creates a new Context with the force fresh dial option. Unlike withForceDirectDial (which only bypasses Swarm.dialPeer's existing-healthy-connection reuse when every healthy connection is relayed — it exists to force a direct dial past a relay conn), this unconditionally skips that reuse for one dial attempt regardless of the existing connection's type. For a caller that has independent, specific reason to believe a particular existing connection is broken (e.g. it just observed a fast disconnect right after adopting it) even though _isConnectionHealthy still reports it healthy — a stream-level RST that doesn't close the underlying muxed session isn't reflected there until the periodic health-probe loop catches up, which can take several probe cycles. See stephanfeb/dart_libp2p#23.
withNoDial(String reason) → Context
Creates a new Context with the no dial option
withSimultaneousConnect(bool isClient, String reason) → Context
Creates a new Context with the simultaneous connect option
withUseTransient(String reason) → Context
Creates a new Context with the use transient option
withValue(Object key, Object? value) → Context
Creates a new Context with a value

Operators

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

Constants

dialPeerTimeout → const Duration
Default timeout for a single call to DialPeer