BroadcastState class

hold state information for a broadcast

Constructors

BroadcastState({required Duration timeout, double considerDonePercent = 1})
creates a new BroadcastState instance

Properties

broadcasts Map<String, RelayBroadcastResponse>
key is relay url, value is RelayBroadcastResponse
getter/setter pair
considerDonePercent double
value between 0 and 1, 1 => all relays have responded with "OK" the broadcast is considered done
final
event Nip01Event?
the event being broadcast (stored for potential retries on auth-required)
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
networkController StreamController<RelayBroadcastResponse>
networkController used by relay manger to write responses
getter/setter pair
publishDone bool
completes when all relays have responded or timed out first string is the relay url, second is the response
no setter
publishDoneFuture Future<BroadcastState>
completes when state update controller closes
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateUpdates Stream<BroadcastState>
stream of state updates
updates are sent when a relay responds, the whole state is sent
if you call .listen() the last state is sent immediately
no setter
timeout Duration
final

Methods

addError(Object error, [StackTrace? stackTrace]) → void
Add an error to the broadcast state stream and dispose
closeIfNoRelays() → void
Close the network controller if no relays were registered. This should be called after broadcast strategies complete to signal that the broadcast is done when there were no relays to broadcast to.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startTimeout() → void
Starts the timeout timer. Call this after signing is complete.
toString() String
A string representation of this object.
inherited

Operators

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