File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments