connectPrinter method
Connects to a Star Micronics printer using the provided identifier and interface type.
identifier
: A unique identifier for the printer.interfaceType
: The connection interface type (e.g., USB, Bluetooth).
Throws a PlatformException if the connection fails.
Implementation
@override
Future<void> connectPrinter(String identifier, String interfaceType) async {
try {
await methodChannel.invokeMethod('connectPrinter',
{"identifier": identifier, "interfaceType": interfaceType});
} catch (e) {
throw PlatformException(
code: 'CONNECT_PRINTER_FAILED',
message: 'Failed to connect to printer: $e',
);
}
}