startPeripheralScan abstract method

Stream<ScanResult> startPeripheralScan({
  1. int scanMode = ScanMode.lowPower,
  2. int callbackType = CallbackType.allMatches,
  3. List<String> uuids = const [],
  4. bool allowDuplicates = false,
})

Starts scanning for peripherals.

Arguments scanMode and callbackType are Android-only, while allowDuplicates is iOS-only. Note that allowDuplicates set to false will only result in slower refresh rate for unique peripheral's advertisement data, not dismissal of it after receiving the initial one. Refer to each platform's own documentation for more detailed information.

uuids is used to filter scan results to those whose advertised service match either of the specified UUIDs.

bleManager.startPeripheralScan().listen((scanResult) {
  //Scan one peripheral and stop scanning
  print("Scanned Peripheral ${scanResult.peripheral.name}, RSSI ${scanResult.rssi}");
  bleManager.stopPeripheralScan();
});

Implementation

Stream<ScanResult> startPeripheralScan({
  int scanMode = ScanMode.lowPower,
  int callbackType = CallbackType.allMatches,
  List<String> uuids = const [],
  bool allowDuplicates = false,
});