copyWith method
Returns a copy of this state with updated fields if provided.
Implementation
MotherDetailsState copyWith({
List<models.Document>? allMothers,
List<models.Document>? filteredMothers,
DateTime? fromDate,
bool clearFromDate = false,
DateTime? tillDate,
bool clearTillDate = false,
String? searchQuery,
bool? isLoading,
String? errorMessage,
bool clearError = false,
}) {
return MotherDetailsState(
allMothers: allMothers ?? this.allMothers,
filteredMothers: filteredMothers ?? this.filteredMothers,
fromDate: clearFromDate ? null : (fromDate ?? this.fromDate),
tillDate: clearTillDate ? null : (tillDate ?? this.tillDate),
searchQuery: searchQuery ?? this.searchQuery,
isLoading: isLoading ?? this.isLoading,
errorMessage: clearError ? null : (errorMessage ?? this.errorMessage),
);
}