openCashDrawer method
Opens the cash drawer connected to the specified printer.
identifier
: A unique identifier for the printer.interfaceType
: The connection interface type (e.g., USB, Bluetooth).
Returns a Future containing a bool indicating whether the operation was successful.
Implementation
@override
Future<bool> openCashDrawer(String identifier, String interfaceType) async {
try {
final bool result =
await methodChannel.invokeMethod<bool>('openCashDrawer', {
"identifier": identifier,
"interfaceType": interfaceType,
}) ??
false;
return result;
} catch (e) {
debugPrint("Error opening cash drawer: $e");
return false;
}
}