appearance property

String? get appearance

Implementation

String? get appearance {
  if (attributes.containsKey(EIRType.Appearance)) {
    assert(attributes[EIRType.Appearance]!.length == 4,
        "Bytes length of appearance must be 4");
    int? value = ByteUtils.bytesToInt(attributes[EIRType.Appearance],
        endianness: Endianness.Little);
    if (appearanceMap.containsKey(value)) {
      return appearanceMap[value];
    } else {
      return "";
    }
  } else {
    return null;
  }
}
set appearance (String? appearance)

Implementation

set appearance(String? appearance) {
  int? index;
  for (var e in appearanceMap.entries) {
    if (e.value == appearance) {
      index = e.key;
      break;
    }
  }
  if (index == null) {
    throw ArgumentError.notNull("Appearance $appearance is not correct");
  }
  attributes[EIRType.Appearance] =
      ByteUtils.intToBytes(index, 4, endianness: Endianness.Little);
}