Node class

Inheritance

Constructors

Node()

Properties

address InternetAddress
current node binding address, check isAlive before use
no setter
bindingPeers List<Peer>
list of binding peers in the node
no setter
hashCode int
The hash code for this object.
no setteroverride
ip String
current node binding ip address, check isAlive before use
no setter
isAlive bool
check the state of node is alive or note
no setter
peers List<Peer>
list of successfully connected peers in the node
no setter
port int
current socket binding port, check isAlive before use
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
socket ServerSocket
socket object of the node
no setter
stream Stream<NodeEvent>
events stream
no setterinherited

Methods

addPeer(Peer peer, {bool preConnected = false}) → void
add peer to the pool of binding peers
clearHandlers() Future<void>
clear all handlers of any event type and clear theme from memory
inherited
completeCompleters() → void
complete all onNextEmit completers and clear them from memory
inherited
destroy() Future<void>
destroy node server
override
disconnectPeers() Future<void>
disconnect all successfully connected peers then clear them from memory
emit<E extends T>(E event) → void
emit event
inherited
filteredStream<E extends T>() Stream<E>
filter events stream for specific sub event type E
inherited
handle<E extends T>(EventHandler<E> handler) → HandlerCanceler
handle events of type E with handler
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on({void start()?, void stop()?, void peerConnect(Peer peer)?, void peerDisconnect(Peer peer)?, void data(Uint8List data, Peer peer)?, void message(Message message, Peer peer)?, void sendData(Uint8List data)?, void sendMessage(Message message)?, void error(String message, Object error, StackTrace stackTrace)?}) → void
handle all the events that the node can emit
onMessage<T extends Message>(void handler(T message, Peer peer)) → void
handle specific message type T
onNextEmit<E extends T>() Future<void>
return Future that completes on the next event emitted of type E
inherited
send(Uint8List data) bool
send bytes to all peers in the pool and returns true if succeeded
sendBytes(List<int> bytes) bool
send list of bytes to all peers in the pool and returns true if succeeded
sendMessage(Message message) bool
send message to all peers in the pool and returns true if succeeded
sendText(String text) bool
send text to all peers in the pool and returns true if
start({InternetAddress? address, int port = 0}) Future<void>
start the node and listen to incoming connections
stop() Future<void>
stop current node server but keeps all event handlers
toString() String
A string representation of this object.
inherited

Operators

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