import 'dart:async'; import 'package:flutter/services.dart'; class Printer { static const MethodChannel _channel = const MethodChannel('printer'); static Future get platformVersion async { final String version = await _channel.invokeMethod('getPlatformVersion'); return version; } Future obtenerDispositivos() async { var result = await _channel.invokeMethod('getDeviceList'); return result; } Future estaConectado() async { var result = await _channel.invokeMethod('isConnected'); return result; } Future conectar(String mac) async { var result = await _channel.invokeMethod('connect', {'mac': mac}); return result; } Future desconectar() async { var result = await _channel.invokeMethod('disconnect'); return result; } Future imprimirTexto(String texto) async { var result = await _channel.invokeMethod('printText', {'text': texto}); return result; } Future imprimirImagen(int ancho, int alto, List imagen) async { var result = await _channel.invokeMethod('printBitmap', { 'width': ancho, 'height': alto, 'map': imagen, }); return result; } Future imprimirImagen2(int ancho, int alto, List imagen) async { var result = await _channel.invokeMethod('printBitmap2', { 'width': ancho, 'height': alto, 'map': imagen, }); return result; } }