getAsPropertiesComplement static method

Map<String, dynamic> getAsPropertiesComplement(
  1. List<CodeFormat> codeFormats, {
  2. bool enabled = true,
})

Returns a Map of Honeywell's Barcode formats properties according to the List of CodeFormat specified and the enabled value which is true by default. This function is useful when you want to enable some codeFormats and disable the rest and the other way around. codeFormats the List of CodeFormat enums to be converted to Honeywell properties enabled the value to be set to the format property, true or false. IMPORTANT:

  • The codeFormats not specified in the codeFormats list will be set to the opposite of enabled like !enabled

Implementation

static Map<String, dynamic> getAsPropertiesComplement(
    List<CodeFormat> codeFormats,
    {bool enabled = true}) {
  Map<String, dynamic> mapProperties =
      getAsProperties(codeFormats, enabled: enabled);
  for (var codeFormat in CodeFormat.values) {
    String? propertyName = codeFormat.propertyName;
    if (propertyName != null && !mapProperties.containsKey(propertyName)) {
      mapProperties[propertyName] = !enabled;
    }
  }
  return mapProperties;
}