copyWith method

Mode copyWith({
  1. String? name,
  2. String? label,
  3. dynamic scope,
  4. dynamic begin,
  5. dynamic end,
  6. dynamic beginScope,
  7. dynamic endScope,
  8. List? contains,
  9. dynamic keywords,
  10. dynamic illegal,
  11. num? relevance,
  12. dynamic subLanguage,
  13. bool? endsWithParent,
  14. bool? endsParent,
  15. bool? excludeBegin,
  16. bool? excludeEnd,
  17. bool? returnBegin,
  18. bool? returnEnd,
  19. bool? skip,
  20. Mode? starts,
  21. List<Mode>? variants,
  22. bool clearVariants = false,
})

Implementation

Mode copyWith({
  String? name,
  String? label,
  dynamic scope,
  dynamic begin,
  dynamic end,
  dynamic beginScope,
  dynamic endScope,
  List<dynamic>? contains,
  dynamic keywords,
  dynamic illegal,
  num? relevance,
  dynamic subLanguage,
  bool? endsWithParent,
  bool? endsParent,
  bool? excludeBegin,
  bool? excludeEnd,
  bool? returnBegin,
  bool? returnEnd,
  bool? skip,
  Mode? starts,
  List<Mode>? variants,
  bool clearVariants = false,
}) {
  final copy = Mode(
    name: name ?? this.name,
    label: label ?? this.label,
    aliases: aliases != null ? List.from(aliases!) : null,
    scope: scope ?? this.scope,
    begin: begin ?? this.begin,
    end: end ?? this.end,
    match: match,
    beginScope: beginScope ?? this.beginScope,
    endScope: endScope ?? this.endScope,
    contains:
        contains ??
        (this.contains != null ? List.from(this.contains!) : null),
    keywords: keywords ?? this.keywords,
    illegal: illegal ?? this.illegal,
    relevance: relevance ?? this.relevance,
    subLanguage: subLanguage ?? this.subLanguage,
    endsWithParent: endsWithParent ?? this.endsWithParent,
    endsParent: endsParent ?? this.endsParent,
    excludeBegin: excludeBegin ?? this.excludeBegin,
    excludeEnd: excludeEnd ?? this.excludeEnd,
    returnBegin: returnBegin ?? this.returnBegin,
    returnEnd: returnEnd ?? this.returnEnd,
    skip: skip ?? this.skip,
    starts: starts ?? this.starts?.shallowCopy(),
    variants: clearVariants ? null : (variants ?? this.variants),
    beginKeywords: beginKeywords,
    beforeMatch: beforeMatch,
    exports: exports,
    preprocessor: preprocessor,
    caseInsensitive: caseInsensitive,
    unicodeRegex: unicodeRegex,
    disableAutodetect: disableAutodetect,
    classNameAliases: classNameAliases != null
        ? Map.from(classNameAliases!)
        : null,
    supersetOf: supersetOf,
    compilerExtensions: compilerExtensions,
    binary: binary,
    onBegin: onBegin,
    onEnd: onEnd,
    beforeBeginCallback: beforeBeginCallback,
    emitTokens: emitTokens,
  );
  return copy;
}