bluetooth_socket.dart 524 B

12345678910111213141516171819202122232425262728
  1. part of flutter_bluetooth;
  2. class BluetoothSocket{
  3. final String _address;
  4. String get address => _address;
  5. final String _uuid;
  6. String get uuid => _uuid;
  7. BluetoothSocket._(this._address, this._uuid){
  8. }
  9. write(Uint8List data) async{
  10. await FlutterBluetooth._channel.invokeMethod('write', {
  11. 'address': address,
  12. 'uuid': uuid,
  13. 'data': data
  14. });
  15. }
  16. close() async{
  17. await FlutterBluetooth._channel.invokeMethod('close', {
  18. 'address': address,
  19. 'uuid': uuid
  20. });
  21. }
  22. }