copyWith method
Creates a copy of this list state but with the given fields replaced with the new values.
If the list is not initialised and isInitialized parameter is not
provided and new records are being provided,
the initialisation marker will be set automatically. Since this is almost
always the expected behaviour.
Implementation
ListState<Record, Query> copyWith({
List<Record>? records,
ListStage? stage,
Query? query,
bool? isInitialized,
}) {
return ListState<Record, Query>(
records: records ?? this.records,
stage: stage ?? this.stage,
query: query ?? this.query,
isInitialized: isInitialized ?? (this.isInitialized || records != null),
);
}