fetchMothersId method
Fetches the list of mothers from the database based on the date range
Implementation
Future<void> fetchMothersId() async {
try {
emit(state.copyWith(isLoading: true, clearError: true));
final result = await fetchMothers(
db,
fromDate: state.fromDate,
tillDate: state.tillDate,
);
emit(
state.copyWith(
allMothers: result,
filteredMothers: result,
isLoading: false,
),
);
_applySearchFilter();
} catch (e) {
emit(
state.copyWith(
isLoading: false,
errorMessage: "Error fetching mothers: $e",
),
);
print("Error fetching mothers: $e");
}
}