Find element in a list of datatypes
Hi guys.
I have the following app state variable:
currentUsersList: List<Data(userType)>
The datatype "userType" is as this:
userType: {name(String), color(String)}
How can I know if a "name" is in the app state variable "currentUsersList"?
Example:
currentUsersList= [{name:"John",color:"red"},{name:"Peter",color:"green"},{name:"Mary",color:"blue"}]
How can I know if "Peter" is in that currentUsersList.
Thanks in advance.