connectToDevice static method

Future<bool> connectToDevice(
  1. String address
)

Implementation

static Future<bool> connectToDevice(String address) async {
  try {
    if (kIsWeb) {
      throw PlatformException(
        code: 'WEB_LIMITATION',
        message: 'Bluetooth Classic not supported on web',
        details:
            'Web browsers only support Bluetooth Low Energy (BLE) connections',
      );
    }

    return await _platform.connect(address);
  } catch (e) {
    if (kDebugMode) print('Error connecting to device: $e');
    rethrow;
  }
}