copyWith method

SourceElement copyWith({
  1. SourceElementType? type,
  2. String? name,
  3. int? startPos,
  4. File? file,
  5. String? className,
  6. List<SourceLine>? comment,
  7. int? startLine,
  8. List<CodeSample>? samples,
  9. bool? override,
})

Copy the source element, with some attributes optionally replaced.

Implementation

SourceElement copyWith({
  SourceElementType? type,
  String? name,
  int? startPos,
  File? file,
  String? className,
  List<SourceLine>? comment,
  int? startLine,
  List<CodeSample>? samples,
  bool? override,
}) {
  return SourceElement(
    type ?? this.type,
    name ?? this.name,
    startPos ?? this.startPos,
    file: file ?? this.file,
    className: className ?? this.className,
    comment: comment ?? this.comment,
    startLine: startLine ?? this.startLine,
    samples: samples ?? this.samples,
    override: override ?? this.override,
  );
}