sendData method

  1. @override
Future<void> sendData(
  1. Uint8List data
)
override

Send data to connected device

Implementation

@override
Future<void> sendData(Uint8List data) async {
  if (_currentState != BluetoothConnectionState.connected) {
    throw BluetoothException('Not connected to any device');
  }

  try {
    await _methodChannel.invokeMethod('sendData', {
      'data': data,
    });
  } catch (e) {
    throw BluetoothException('Failed to send data: $e');
  }
}