getConnectedBluetoothDevices method

  1. @override
Future<List<ConnectedBluetoothDeviceInfo>> getConnectedBluetoothDevices()
override

Get system Bluetooth devices currently connected on Android

Implementation

@override
Future<List<ConnectedBluetoothDeviceInfo>>
getConnectedBluetoothDevices() async {
  final result = await methodChannel.invokeMethod<List<dynamic>>(
    'getConnectedBluetoothDevices',
  );

  return (result ?? const [])
      .map(
        (item) => ConnectedBluetoothDeviceInfo.fromMap(
          Map<String, dynamic>.from(item as Map),
        ),
      )
      .toList();
}