Nearby class
The NearbyConnection class
Only one instance is maintained even on calling Nearby() multiple times
All methods are asynchronous.
Constructors
- Nearby()
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
acceptConnection(
String endpointId, {required OnPayloadReceived onPayLoadRecieved, OnPayloadTransferUpdate? onPayloadTransferUpdate}) → Future< bool> - Needs be called by both discoverer and advertiser to connect
-
cancelPayload(
int payloadId) → Future< void> - Use it to cancel/stop a payload transfer
-
copyFileAndDeleteOriginal(
String sourceUri, String destinationFilepath) → Future< bool> - convenience method
-
disconnectFromEndpoint(
String endpointId) → Future< void> - Disconnect from Endpoints
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rejectConnection(
String endpointId) → Future< bool> - Reject Connection
-
requestConnection(
String userNickName, String endpointId, {required OnConnectionInitiated onConnectionInitiated, required OnConnectionResult onConnectionResult, required OnDisconnected onDisconnected}) → Future< bool> - Request Connection
-
sendBytesPayload(
String endpointId, Uint8List bytes) → Future< void> - Send bytes Uint8List payload to endpoint
-
sendFilePayload(
String endpointId, String filePath) → Future< int> - Returns the payloadID as soon as file transfer has begun
-
startAdvertising(
String userNickName, Strategy strategy, {required OnConnectionInitiated onConnectionInitiated, required OnConnectionResult onConnectionResult, required OnDisconnected onDisconnected, String serviceId = "com.pkmnapps.nearby_connections"}) → Future< bool> - Start Advertising, Discoverers would be able to discover this advertiser.
-
startDiscovery(
String userNickName, Strategy strategy, {required OnEndpointFound onEndpointFound, required OnEndpointLost onEndpointLost, String serviceId = "com.pkmnapps.nearby_connections"}) → Future< bool> - Start Discovery, You will now be able to discover the advertisers now.
-
stopAdvertising(
) → Future< void> - Stop Advertising
-
stopAllEndpoints(
) → Future< void> - Stop All Endpoints
-
stopDiscovery(
) → Future< void> - Stop Discovery
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited