getLabelFromCode method

String getLabelFromCode()

Implementation

String getLabelFromCode() {
  String labelResponse = '';
  String blockParsedHex = hex.encode(blockParsed);
  if (kDebugMode) {
    print(blockParsedHex);
  }

  if (blockParsedHex.length >= 4) {
    switch (blockParsedHex.substring(blockParsedHex.length - 4)) {
      case '6d00':
        labelResponse = 'Invalid parameter received';
        break;
      case '670A':
        labelResponse = 'Lc is 0x00 whereas an application name is required';
        break;
      case '6807':
        labelResponse = 'The requested application is not present';
        break;
      case '6985':
        labelResponse = 'Cancel the operation';
        break;
      case '9000':
        labelResponse = 'Success of the operation';
        break;
      case '0000':
        labelResponse = 'Success of the operation';
        break;
      default:
        labelResponse = blockParsedHex.substring(blockParsedHex.length - 4);
    }
  }
  return labelResponse;
}