ConnectionsManager class

Class to manage conections coming from NearbyCross plugin

Constructors

ConnectionsManager({AuthenticationManager? authenticationManager})
ConnectionsManager implements the singleton pattern. There will be only one instance of this class
factory

Properties

authenticationManager AuthenticationManager?
getter/setter pair
callbackConnectionInitiated HashMap<String, dynamic Function(Device)>
getter/setter pair
callbackConnectionRejected HashMap<String, dynamic Function(Device)>
getter/setter pair
callbackDisconnectedDevice HashMap<String, dynamic Function(Device)>
getter/setter pair
callbackPendingAcceptConnection HashMap<String, dynamic Function(Device)>
getter/setter pair
callbackReceivedMessage HashMap<String, dynamic Function(Device)>
getter/setter pair
callbackSuccessfulConnection HashMap<String, dynamic Function(Device)>
getter/setter pair
connectedDevices Set<Device>
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
initiatedConnections Set<Device>
getter/setter pair
logger ↔ Logger
getter/setter pair
nearbyCross NearbyCross
getter/setter pair
pendingAcceptConnections Set<Device>
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

acceptConnection(String endpointId) Future<void>
Accepts a pending connection
addConnectedDevice(String endpointId) Device?
Adds a device in connectedDevices set, removing it from initiatedConnections set after.
addDeviceAsInitiatedConnection(Device device) Device
addInitiatedConnection(String endpointId, Uint8List endpointName) Device
Creates a device in initiatedConnections set.
addMessageFromDevice(String endpointId, NearbyMessage message) Device?
Adds message received to the device where it comes from.
addPendingAcceptConnection(String endpointId, Uint8List endpointName) Device
Adds a device in pendingAcceptConnections set.
broadcastMessage(NearbyMessage message) → void
Broadcasts a message to every connected device
disconnectFromEndpoint(String endpointId) Future<void>
Disconnects from a given device by its endpointId
enterHandshakeProcess(String endpointId, NearbyMessage message) Device?
Enters into handshaking process. See docs for reference.
getAllConnectedDevices() List<Device>
Return a list with all connected Devices
getConnectedDevice(String endpointId) Device?
Return Device with endpointId
getSigningManager() SigningManager?
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rejectConnection(String endpointId) Future<void>
Rejects a pending connection
removeConnectedDevices(String endpointId) Device?
removeNamedCallback(String callbackKey) → void
Removes a named callback in all callback collections
sendMessageToDevice(String endpointId, String message) → void
Sends message to a given device given its endpointId
setCallbackConnectionInitiated(String callbackId, dynamic callbackConnectionInitiated(Device)) → void
Sets callbackConnectionInitiated callback that executes every time a connection is initiated.
setCallbackConnectionRejected(String callbackId, dynamic callbackConnectionRejected(Device)) → void
Sets callbackConnectionRejected callback that executes every time a connection is rejected.
setCallbackDisconnectedDevice(String callbackId, dynamic callbackDisconnectedDevice(Device)) → void
Sets callbackDisconnectedDevice that executes every time a device is disconnected
setCallbackPendingAcceptConnection(String callbackId, dynamic callbackPendingAcceptConnection(Device)) → void
Sets callbackConnectionInitiated callback that executes every time a connection needs to be accepted.
setCallbackReceivedMessage(String callbackId, dynamic callbackReceivedMessage(Device)) → void
Sets callbackReceivedMessage callback that executes every time a device receives a message.
setCallbackReceivedMessageForDevice(String endpointId, dynamic callbackReceivedMessage(Device), {String callbackName = "ConnectionsManager:receivedMessageForDevice"}) → void
Sets callbackReceivedMessage callback for a given device that executes every time a message is received from that device.
setCallbackSuccessfulConnection(String callbackId, dynamic callbackSuccessfulConnection(Device)) → void
Sets callbackSuccessfulConnection callback that executes every time a connection successfully finishes.
signDeviceInfo(String deviceInfo) Uint8List
toString() String
A string representation of this object.
inherited
unsetCallbackReceivedMessageForDevice(String endpointId, {String callbackName = "ConnectionsManager:receivedMessageForDevice"}) → void
Unsets a received message callback for a given Device endpointId

Operators

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

Static Methods

destroy() → void
Destroys the singleton instance, allowing to create a new one