Check value in array exists Flutter dart
Above are the correct answers to the current question. But if someone like me is here to check value inside List of Class object then here is the answer.
class DownloadedFile {
String Url;
String location;
}
List of DownloadedFile
List<DownloadedFile> listOfDownloadedFile = List();
listOfDownloadedFile.add(...);
Now check if a specific value is inside this list
var contain = listOfDownloadedFile.where((element) => element.Url == "your URL link");
if (contain.isEmpty)
//value not exists
else
//value exists
There maybe better way/approach. If someone know, then let me know. :)
list.contains(x);
Contains method