bluetooth_print 0.0.5 copy "bluetooth_print: ^0.0.5" to clipboard
bluetooth_print: ^0.0.5 copied to clipboard

outdated

A new flutter plugin project connect to bluetooth thermal printer (Gprinter).

pub package

Introduction #

BluetoothPrint is a bluetooth plugin for Flutter, a new mobile SDK to help developers build bluetooth thermal printer apps for iOS and Android.(for example, Gprinter pt-380 eg.)

Features #

Android iOS Description
select devices scan for Bluetooth Low Energy devices and select.
connect Establishes a connection to the device.
disconnect Cancels an active or pending connection to the device.
print test message print device test message.
print text print custom text, support layout.
print image print image.
print qrcode print qrcode,support change size.
display connect status Stream of state changes for the Bluetooth Device.

Usage #

Example

To use this plugin :

  dependencies:
    flutter:
      sdk: flutter
    bluetooth_print:
  • init a BluetoothPrint instance
import 'package:bluetooth_print/bluetooth_print.dart';
import 'package:bluetooth_print/bluetooth_print_model.dart';


BluetoothPrint bluetoothPrint = BluetoothPrint.instance;

getDevices #

List<BluetoothDevice> list = await bluetoothPrint.getBondedDevices();

connect #

await bluetoothPrint.connect(_device);

disconnect #

await bluetoothPrint.disconnect();

listen state #

      bluetoothPrint.state.listen((state) {
      print('cur device status: $state');

      switch (state) {
        case BluetoothPrint.CONNECTED:
          setState(() {
            _connected = true;
          });
          break;
        case BluetoothPrint.DISCONNECTED:
          setState(() {
            _connected = false;
          });
          break;
        default:
          break;
      }
    });
240
likes
0
pub points
95%
popularity

Publisher

unverified uploader

A new flutter plugin project connect to bluetooth thermal printer (Gprinter).

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, json_annotation

More

Packages that depend on bluetooth_print