execute method

Future<Message> execute(
  1. int command, {
  2. String? data,
})

Implementation

Future<Message> execute(int command, {String? data}) async {
  await writePackage(command, data: data);

  final message = await readPackage();
  _status = message.status;
  if (command != Commands.status.code) {
    final exeptions = _status?.criticalStatuses(_critialStatus);
    if (exeptions != null && exeptions.isNotEmpty) {
      throw FiscalParserException(
        "Critical status detected: ${exeptions.join('; ')}",
        10,
      );
    }
  }
  return message;
}