copyWith method
A copy with the given conditions replaced; omitted ones are kept.
A condition is cleared with its empty value: copyWith(levels: {}, text: ''). after and before
have no empty value (null means "keep"), so they are passed as a function returning the new value:
copyWith(after: () => weekAgo); to clear, copyWith(after: () => null).
Implementation
LogFilter copyWith({
DateTime? Function()? after,
DateTime? Function()? before,
Set<LogLevel>? levels,
Set<String>? tags,
List<LogAttribute<Object>>? attributes,
String? text,
}) => LogFilter(
after: after == null ? this.after : after(),
before: before == null ? this.before : before(),
levels: levels ?? this.levels,
tags: tags ?? this.tags,
attributes: attributes ?? this.attributes,
text: text ?? this.text,
);