SingleSelectEnumSchema.fromJson constructor

SingleSelectEnumSchema.fromJson(
  1. Map<String, Object?> json
)

Reads the branch json names; an unrecognised one is kept as UnknownSingleSelectEnumSchema.

Implementation

factory SingleSelectEnumSchema.fromJson(Map<String, Object?> json) {
  if ({'string'}.contains(json['type']) && json.containsKey('enum')) return UntitledSingleSelectEnumSchema.fromJson(json);
  if ({'string'}.contains(json['type']) && json.containsKey('oneOf')) return TitledSingleSelectEnumSchema.fromJson(json);
  return UnknownSingleSelectEnumSchema.fromJson(json);
}