flutter_thermal_printer 0.0.2 copy "flutter_thermal_printer: ^0.0.2" to clipboard
flutter_thermal_printer: ^0.0.2 copied to clipboard

Plugin for Flutter to print on thermal printers via ESC/POS commands.

flutter_thermal_printer #

Package for all services for thermal printer in android, ios, macos, windows.

Getting Started #

This plugin is used to print data on thermal printer.

Currently Supported #

Service Android iOS macOS Windows
Bluetooth
USB
 final _flutterThermalPrinterPlugin = FlutterThermalPrinter.instance;

  List<Printer> bleDevices = [];

  StreamSubscription<List<Printer>>? _devicesStreamSubscription;

  //  Start scanning for BLE devices
  Future<void> startScan() async {
    try {
      await _flutterThermalPrinterPlugin.startScan();
      _devicesStreamSubscription =
          _flutterThermalPrinterPlugin.devicesStream.listen((event) {
        setState(() {
          bleDevices = event.map((e) => Printer.fromJson(e.toJson())).toList();
          bleDevices.removeWhere(
            (element) => element.name == null || element.name!.isEmpty,
          );
        });
      });
    } catch (e) {
      log('Failed to start scanning for devices $e');
    }
  }

  // Stop scanning for BLE devices
  Future<void> stopScan() async {
    try {
      _devicesStreamSubscription?.cancel();
      await _flutterThermalPrinterPlugin.stopScan();
    } catch (e) {
      log('Failed to stop scanning for devices $e');
    }
  }

Bluetooth Services #

Feature Android iOS macOS Windows
Start scanning
stop scanning
connect printer
disconnect printer
print data

Printer Model Class #

 String? address;
  String? name;
  ConnectionType? connectionType;
  bool? isConnected;
  String? vendorId;
  String? productId;

// Enum ConnectionType
enum ConnectionType {
  BLE,
  USB,
}

22
likes
0
pub points
90%
popularity

Publisher

verified publishersunilflutter.in

Plugin for Flutter to print on thermal printers via ESC/POS commands.

Homepage

License

unknown (license)

Dependencies

esc_pos_utils, flutter, flutter_blue_plus, plugin_platform_interface, win_ble

More

Packages that depend on flutter_thermal_printer