blueprint_flutter 0.0.1 copy "blueprint_flutter: ^0.0.1" to clipboard
blueprint_flutter: ^0.0.1 copied to clipboard

plugin de impresion por bluetooh.

blueprint_flutter #

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

Inspired by bluetooth_print.

Inspired by flutter_bluetooth_basic

Main Features #

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

Bluetooth Status #

Check that bluetooth is on. For a complete example, see the /example folder. These are just the most important parts of the code to illustrate how to use the library.

BluetoothManager bluetoothManager = BluetoothManager.instance;

....
var bluetoothIsOn = await bluetoothManager.isOn;

if(bluetoothIsOn){
    print("Bluetooth encendido");
    .....
}else{
    print("Encienda el bluetooth");
    .....
}

.......

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();

Bluetooth connect device #

For a complete example, see the /example folder. These are just the most important parts of the code to illustrate how to use the library.

BluetoothManager bluetoothManager = BluetoothManager.instance;

....
    await bluetoothManager.connect(_device);
.......

Bluetooth print data #

For a complete example, see the /example folder. These are just the most important parts of the code to illustrate how to use the library.

BluetoothManager bluetoothManager = BluetoothManager.instance;

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

Bluetooth disconnect device #

For a complete example, see the /example folder. These are just the most important parts of the code to illustrate how to use the library.

BluetoothManager bluetoothManager = BluetoothManager.instance;

....
    await bluetoothManager.disconnect();
.......

Bluetooth destroy device #

For a complete example, see the /example folder. These are just the most important parts of the code to illustrate how to use the library.

BluetoothManager bluetoothManager = BluetoothManager.instance;

....
    await bluetoothManager.destroy();
.......

See also #

1
likes
130
points
26
downloads

Publisher

unverified uploader

Weekly Downloads

plugin de impresion por bluetooh.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, json_annotation, plugin_platform_interface, rxdart

More

Packages that depend on blueprint_flutter