powerSourceDTONullableFromJson function

PowerSourceDTO? powerSourceDTONullableFromJson(
  1. Object? powerSourceDTO, [
  2. PowerSourceDTO? defaultValue
])

Implementation

enums.PowerSourceDTO? powerSourceDTONullableFromJson(
  Object? powerSourceDTO, [
  enums.PowerSourceDTO? defaultValue,
]) {
  if (powerSourceDTO == null) {
    return null;
  }
  return enums.PowerSourceDTO.values
          .firstWhereOrNull((e) => e.value == powerSourceDTO) ??
      defaultValue;
}