Skip to content

Commit 2b0b222

Browse files
committed
changes in retreiving list
1 parent d15b8a6 commit 2b0b222

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/controller/WidgetController.dart

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,21 @@ class WidgetController extends GetxController {
5151
}
5252

5353
Future<void> sendData() async {
54-
int i=1;
54+
int i = 1;
5555
List<Map<String, String>> l = [];
5656
for (var task in allData) {
57-
l.add({
58-
"description": "$i.${task.description}",
59-
"urgency": 'urgencyLevel : ${urgency(task)}',
60-
});
61-
i++;
57+
if (task.status == "pending") {
58+
l.add({
59+
"description": "$i.${task.description}",
60+
"urgency": 'urgencyLevel : ${urgency(task)}',
61+
});
62+
i++;
63+
}
6264
}
63-
await HomeWidget.saveWidgetData(
64-
'tasks', jsonEncode(l));
65+
if (l.isEmpty) {
66+
l.add({"description": "No tasks added yet.", "urgency": "urgencyLevel : 0"});
67+
}
68+
await HomeWidget.saveWidgetData('tasks', jsonEncode(l));
6569
}
6670

6771
Future updateWidget() async {

0 commit comments

Comments
 (0)