printCommand method

  1. @override
Future<bool> printCommand({
  1. String address = "",
  2. String iniCommand = "",
  3. String cutterCommands = "",
  4. String img = "",
  5. String encode = "",
  6. bool isCut = false,
  7. bool isDisconnect = false,
  8. bool isDevicePOS = false,
  9. int timeout = 30,
  10. int width = 576,
})
override

Implementation

@override
Future<bool> printCommand({
  String address = "",
  String iniCommand = "",
  String cutterCommands = "",
  String img = "",
  String encode = "",
  bool isCut = false,
  bool isDisconnect = false,
  bool isDevicePOS = false,
  int timeout = 30,
  int width = 576,
}) async {
  try {
    final version = await methodChannel.invokeMethod('printCommand', {
      'address': address,
      'iniCommand': iniCommand,
      'cutterCommands': cutterCommands,
      'img': img,
      'encode': encode,
      'isCut': isCut,
      'isDisconnect': isDisconnect,
      'isDevicePOS': isDevicePOS,
      'width': width,
    }).timeout(
      Duration(seconds: timeout), // กำหนด Timeout 30
      onTimeout: () {
        throw TimeoutException(
            "Method disconnect timed out after 5 minutes.");
      },
    );
    return version;
  } on TimeoutException catch (e) {
    return false;
  } catch (e) {
    return false;
  }
}