I know this is an old thread, Thought of updating this anyway as it might help someone else.
You can try using FlutterBlue bluetooth plugin, which is a new SDK from Flutter.
FlutterBlue aims to offer the most from both platforms (iOS and Android).
FlutterBlue should work for both Android and IOS platform. The plugin should also help to scan and connect nearby devices.
Here is the sample from the documentation:
[https://github.com/pauldemarco/flutter_blue#obtain-an-instance][1]
Obtain an instance:
FlutterBlue flutterBlue = FlutterBlue.instance;
isAvailable property checks if whether the device supports Bluetooth
Future<bool> get isAvailable =>
_channel.invokeMethod('isAvailable').then<bool>((d) => d);
isOn property Checks if Bluetooth functionality is turned on :
Future<bool> get isOn => _channel.invokeMethod('isOn').then<bool>((d) => d);
Scan for devices :[https://github.com/pauldemarco/flutter_blue#scan-for-devices][2]
// Start scanning
flutterBlue.startScan(timeout: Duration(seconds: 4));
// Listen to scan results
var subscription = flutterBlue.scanResults.listen((scanResult) {
// do something with scan result
device = scanResult.device;
print('${device.name} found! rssi: ${scanResult.rssi}');
});
// Stop scanning
flutterBlue.stopScan();
Connect/disconnect to a device
https://github.com/pauldemarco/flutter_blue#connect-to-a-device
// Connect to the device
await device.connect();
// Disconnect from device
device.disconnect();
Discover services:
https://github.com/pauldemarco/flutter_blue#discover-services
List<BluetoothService> services = await device.discoverServices();
services.forEach((service) {
// do something with service
});
You can scan for low energy devices with ScanMode.lowLatency :
Stream<ScanResult> scan({
ScanMode scanMode = ScanMode.lowLatency,
List<Guid> withServices = const [],
List<Guid> withDevices = const [],
Duration timeout,
}) async* {
var settings = protos.ScanSettings.create()
..androidScanMode = scanMode.value
..serviceUuids.addAll(withServices.map((g) => g.toString()).toList());
if (_isScanning.value == true) {
throw Exception('Another scan is already in progress.');
}
....
You can also read, write the characters and discriptors or do other stuff with the help of FlutterBlue. Hope that helps.
[1]: https://github.com/pauldemarco/flutter_blue#obtain-an-instance
[2]: https://github.com/pauldemarco/flutter_blue#scan-for-devices