I want to compare UserInput with normalList,protanList and deutanList
but I dont know how to turn this in dart language (I'm still new at this)
This is the list that I do not know how to make it into code: -
this is what I attempt to do with the list, is this correct????
List<CheckResult> checkNormal() {
List<CheckResult> normalList = []; normalList.add(CheckResult("1", "12")); normalList.add(CheckResult("2", "8")); normalList.add(CheckResult("3", "6")); normalList.add(CheckResult("6", "5")); normalList.add(CheckResult("12", "97")); ... }
This is what I attempt to do for the result
if(userInput == normalList){
result = "You are Normal"
} else if (userInput == protanList) {
result= "You are Protan Deficiency"
} else {
result = "You are Deutan Deficiency"
}
To check item if contains on list, you can use myList.contains(value)
if(normalList.contains(userInput)){
result = "You are Normal"
} else if (protanList.contains(userInput)) {
result= "You are Protan Deficiency"
} else {
result = "You are Deutan Deficiency"
}
More about List
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.