In this post, we will see how to resolve flutter UI page navigation
Question:
PlanDaysExList is a list that has workout exercises and if the list is empty…it should navigate me to therestScreen()
/ if the list has exercises…it should navigate me to the getPlanExercisesScreen()
my problem is that when the list has exercises or empty…it always navigate me to the
getPlanExercisesScreen()
i don’t know where the problem is.here is my code:
getPlanExercisesScreen()
however when i navigate there…it doesn’t show me the exercises so that mean the list is empty! what am i missing ?Best Answer:
The error lies in the line where you check whether the list is empty or not.if(list1 == []
(in your case) with isEmpty
method of the list.The reason is that you can not compare lists like you’d do in Python, without checking for ListEquality (imported from collection.dart):
If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com