copyWith method

StringSchema copyWith({
  1. String? description,
  2. StringSchemaFormat? format,
  3. int? maxLength,
  4. int? minLength,
  5. String? title,
  6. String? defaultValue,
})

A copy with the given properties replaced; everything else, unknown keys included, is kept.

Implementation

StringSchema copyWith({
  String? description,
  StringSchemaFormat? format,
  int? maxLength,
  int? minLength,
  String? title,
  String? defaultValue,
}) =>
    StringSchema.fromJson({
      ...toJson(),
      if (description != null) 'description': $encode(description),
      if (format != null) 'format': $encode(format),
      if (maxLength != null) 'maxLength': $encode(maxLength),
      if (minLength != null) 'minLength': $encode(minLength),
      if (title != null) 'title': $encode(title),
      if (defaultValue != null) 'default': $encode(defaultValue),
    });