Go to file
ayub a0f0cd5f48 init 2025-09-06 18:38:40 +07:00
android init 2025-09-06 18:38:40 +07:00
example init 2025-09-06 18:38:40 +07:00
ios init 2025-09-06 18:38:40 +07:00
lib init 2025-09-06 18:38:40 +07:00
test init 2025-09-06 18:38:40 +07:00
.gitignore init 2025-09-06 18:38:40 +07:00
CHANGELOG.md init 2025-09-06 18:38:40 +07:00
LICENSE init 2025-09-06 18:38:40 +07:00
README.md init 2025-09-06 18:38:40 +07:00
flutter_bluetooth_basic.iml init 2025-09-06 18:38:40 +07:00
pubspec.yaml init 2025-09-06 18:38:40 +07:00

README.md

flutter_bluetooth_basic

Flutter plugin that allows to find bluetooth devices & send raw bytes data. Supports both Android and iOS.

Inspired by bluetooth_print.

Main Features

  • Android and iOS support
  • Scan for bluetooth devices
  • Send raw List<int> bytes data to a device

Getting Started

For a full example please check /example folder. Here are only the most important parts of the code to illustrate how to use the library.

BluetoothManager bluetoothManager = BluetoothManager.instance;
BluetoothDevice _device;

bluetoothManager.startScan(timeout: Duration(seconds: 4));
bluetoothManager.state.listen((state) {
    switch (state) {
    case BluetoothManager.CONNECTED:
        // ...
        break;
    case BluetoothManager.DISCONNECTED:
        // ...
        break;
    default:
        break;
    }
});
// bluetoothManager.scanResults is a Stream<List<BluetoothDevice>> sending the found devices.

// _device = <from bluetoothManager.scanResults>

await bluetoothManager.connect(_device);

List<int> bytes = latin1.encode('Hello world!\n').toList();
await bluetoothManager.writeData(bytes);

await bluetoothManager.disconnect();

See also