copyWith method

NaturalLanguage copyWith({
  1. String? bibliographicCode,
  2. String? code,
  3. String? codeShort,
  4. NaturalLanguageFamily? family,
  5. bool? isRightToLeft,
  6. String? name,
  7. List<String>? namesNative,
  8. Set<Script>? scripts,
  9. LocaleMapFunction<String> mapper()?,
})

Creates a new instance of NaturalLanguage with updated properties.

The optional named parameters can be used to specify new values for the corresponding properties. If a named parameter is not provided, the corresponding property is copied from the original instance.

Example usage:

const english = LangEng();

final americanEnglish = english.copyWith(
  name: 'American English',
);

Implementation

NaturalLanguage copyWith({
  String? bibliographicCode,
  String? code,
  String? codeShort,
  NaturalLanguageFamily? family,
  bool? isRightToLeft,
  String? name,
  List<String>? namesNative,
  Set<Script>? scripts,

  /// {@macro sealed_world.locale_mapper_callback}
  LocaleMapFunction<String> Function()? mapper,
}) => LangCustom(
  name: name ?? this.name,
  codeShort: codeShort ?? this.codeShort,
  namesNative: namesNative ?? this.namesNative,
  code: code ?? this.code,
  bibliographicCode: (bibliographicCode?.isEmpty ?? false)
      ? null
      : (bibliographicCode ?? this.bibliographicCode),
  family: family ?? this.family,
  isRightToLeft: isRightToLeft ?? this.isRightToLeft,
  scripts: scripts ?? this.scripts,
  mapper: mapper ?? l10n.mapper,
);