NearbyService class abstract
The main tool for working with a P2P network. Implementations:
- for Android - NearbyAndroidService
- for IOS - NearbyIOSService
The plugin is not supported for other platforms yet
- Implementers
- Available Extensions
Constructors
Properties
- android → NearbyAndroidService?
-
Returns NearbyService cast as NearbyAndroidService if the current
platform is Android. Otherwise, returns null.
latefinal
-
communicationChannelState
→ ValueListenable<
CommunicationChannelState> -
A value to determine the communication channel's status.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- ios → NearbyIOSService?
-
Returns NearbyService cast as NearbyIOSService if the current
platform is IOS. Otherwise, returns null.
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
connect(
NearbyDevice device) → Future< bool> -
Connects to passed
device
using a platform-specific service. -
disconnect(
[NearbyDevice? device]) → Future< bool> -
Disconnects from passed
device
using a platform-specific service. -
discover(
) → Future< bool> - Starts searching for devices using a platform-specific service.
-
endCommunicationChannel(
) → FutureOr< bool> - If you called startCommunicationChannel, remember that you have created a subscription to receive messages.
-
getConnectedDeviceStream(
NearbyDevice device) → Stream< NearbyDevice?> - Returns the constantly updating NearbyDevice you are currently connected to. If it returns null, then there is no connection at the moment.
-
getCurrentDeviceInfo(
) → Future< NearbyDeviceInfo?> - Getting info about the current device in P2P scope.
-
getPeers(
) → Future< List< NearbyDevice> > - A single retrieval of the current list of devices in a P2P network.
-
getPeersStream(
) → Stream< List< NearbyDevice> > - Returns a constantly updating list of NearbyDevice that the platform-specific service has found at each point in time.
-
getPlatformModel(
) → Future< String?> - Gets model of current device.
-
getPlatformVersion(
) → Future< String?> - Gets version of current platform.
-
initialize(
{NearbyInitializeData data = const NearbyInitializeData()}) → Future< bool> - Initialization of a platform-specific service.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openServicesSettings(
) → Future< void> - Since Wi-fi must be enabled to use the plugin in Android, openServicesSettings can be used to redirect the user to the Wi-fi service settings on Android.
-
send(
OutgoingNearbyMessage< NearbyMessageContent> message) → FutureOr<bool> - Method to send data to the created communication channel.
-
startCommunicationChannel(
NearbyCommunicationChannelData data) → FutureOr< bool> - If the device is already connected, it does not mean that you can send and receive data.
-
stopDiscovery(
) → Future< bool> - Stops searching for devices using a platform-specific service.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
getInstance(
{NearbyServiceLogLevel? logLevel}) → NearbyService - The only way to get an instance of NearbyService.