flutter_bluetooth_basic 0.1.3 copy "flutter_bluetooth_basic: ^0.1.3" to clipboard
flutter_bluetooth_basic: ^0.1.3 copied to clipboard

outdated

Flutter plugin that allows to send bytes data to a bluetooth device.

flutter_bluetooth_basic #

Flutter plugin that allows to send raw bytes data to a bluetooth device. Supports both Android and iOS.

Inspired by bluetooth_print.

Main Features #

  • Android and iOS support
  • Scan bluetooth devices (start scan, stop scan)
  • Send raw List<int> bytes array to a device

Getting Started #

For a full example please check /example folder. Here are only 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 #

74
likes
0
pub points
89%
popularity

Publisher

verified publishertablemi.com

Flutter plugin that allows to send bytes data to a bluetooth device.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, json_annotation, rxdart

More

Packages that depend on flutter_bluetooth_basic