startScan method
Start scanning for beacons
iBeaconUUIDs - Optional list of iBeacon UUIDs to scan for on iOS.
iOS requires specific UUIDs to detect iBeacons via Core Location.
On Android, this parameter is ignored as BLE scanning detects all beacons.
Implementation
@override
Future<bool> startScan({List<String>? iBeaconUUIDs}) async {
try {
final Map<String, dynamic> arguments = {};
if (iBeaconUUIDs != null && iBeaconUUIDs.isNotEmpty) {
arguments['iBeaconUUIDs'] = iBeaconUUIDs;
}
final bool? result = await methodChannel.invokeMethod<bool>(
'startScan',
arguments.isEmpty ? null : arguments,
);
return result ?? false;
} on PlatformException catch (e) {
debugPrint("Error starting scan: ${e.message}");
return false;
}
}