startDiscovery method

Future<bool> startDiscovery(
  1. String userNickName,
  2. Strategy strategy, {
  3. required OnEndpointFound onEndpointFound,
  4. required OnEndpointLost onEndpointLost,
  5. String serviceId = "com.pkmnapps.nearby_connections",
})

Start Discovery, You will now be able to discover the advertisers now.

serviceId is a unique identifier for your app, its recommended to use your app package name only, it cannot be null userNickName and strategy should not be null

Implementation

Future<bool> startDiscovery(
  String userNickName,
  Strategy strategy, {
  required OnEndpointFound onEndpointFound,
  required OnEndpointLost onEndpointLost,
  String serviceId = "com.pkmnapps.nearby_connections",
}) async {
  _onEndpointFound = onEndpointFound;
  _onEndpointLost = onEndpointLost;

  return await _channel.invokeMethod('startDiscovery', <String, dynamic>{
        'userNickName': userNickName,
        'strategy': strategy.index,
        'serviceId': serviceId,
      }) ??
      false;
}