From 4b23db582ad5431008d351316e3b628a62e56229 Mon Sep 17 00:00:00 2001 From: zaid_daoud Date: Thu, 3 Aug 2023 12:51:25 +0300 Subject: [PATCH] Enhancement --- lib/controllers/providers/api/gas_refill_provider.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/controllers/providers/api/gas_refill_provider.dart b/lib/controllers/providers/api/gas_refill_provider.dart index cadcf8e..251ac3c 100644 --- a/lib/controllers/providers/api/gas_refill_provider.dart +++ b/lib/controllers/providers/api/gas_refill_provider.dart @@ -68,7 +68,11 @@ class GasRefillProvider extends ChangeNotifier { // client's request was successfully received List requestsListJson = json.decode(response.body)["data"]; List itemsPage = requestsListJson.map((request) => GasRefillModel.fromJson(request)).toList(); - items ??= []; + if (mostRecent != null) { + items = []; + } else { + items ??= []; + } items.addAll(itemsPage); sortMostRecent(items, mostRecent); if (itemsPage.length == pageItemNumber) {