connect method
Implementation
Future<bool> connect({required PrinterType type, required BasePrinterInput model}) async {
if (type == PrinterType.bluetooth && (Platform.isIOS || Platform.isAndroid)) {
try {
var conn = await bluetoothPrinterConnector.connect(model as BluetoothPrinterInput);
return conn;
} catch (e) {
throw Exception('model must be type of BluetoothPrinterInput');
}
} else if (type == PrinterType.usb && (Platform.isAndroid || Platform.isWindows)) {
try {
var conn = await usbPrinterConnector.connect(model as UsbPrinterInput);
return conn;
} catch (e) {
throw Exception('model must be type of UsbPrinterInput');
}
} else {
try {
var conn = await tcpPrinterConnector.connect(model as TcpPrinterInput);
return conn;
} catch (e) {
throw Exception('model must be type of TcpPrinterInput');
}
}
}