fetchAllResponses method
Future<void>
fetchAllResponses(
)
Implementation
Future<void> fetchAllResponses() async {
_getAllResponsesState = RequestState.loading;
notifyListeners();
final result = await getLogUseCase!.execute();
result.fold(
(failure) {
_getAllResponsesState = RequestState.error;
_message = failure.message;
notifyListeners();
},
(responses) {
_getAllResponsesState = RequestState.loaded;
_getAllResponses = responses;
_getAllResponses.sort(
(call1, call2) =>
call2.request?.createdAt?.compareTo(call1.request!.createdAt!) ??
-1,
);
notifyListeners();
},
);
}