build method

  1. @override
Map<String, Object?> build()
override

Implementation

@override
Map<String, Object?> build() => {
      'type': type.value,
      'name': name,
      if (nameLocalizations != null) 'name_localizations': {for (final MapEntry(:key, :value) in nameLocalizations!.entries) key.identifier: value},
      'description': description,
      if (descriptionLocalizations != null)
        'description_localizations': {for (final MapEntry(:key, :value) in descriptionLocalizations!.entries) key.identifier: value},
      if (isRequired != null) 'required': isRequired,
      if (choices != null) 'choices': choices!.map((e) => e.build()).toList(),
      if (options != null) 'options': options!.map((e) => e.build()).toList(),
      if (channelTypes != null) 'channel_types': channelTypes!.map((e) => e.value).toList(),
      if (minValue != null) 'min_value': minValue,
      if (maxValue != null) 'max_value': maxValue,
      if (minLength != null) 'min_length': minLength,
      if (maxLength != null) 'max_length': maxLength,
      if (hasAutocomplete != null) 'autocomplete': hasAutocomplete,
    };