Mohammad Nazari
Mohammad Nazari

Reputation: 3025

find index value in list on dart language

i have a list

var lst = [ "test0" , "test1" , "test2" , "test3"];

I want to search inside this list and find the "test2" index. Is there such a function within the dart language?

//lst.find("test2") -> 2

Upvotes: 1

Views: 117

Answers (1)

Alexandre Ardhuin
Alexandre Ardhuin

Reputation: 76183

You can use List.indexOf.

lst.indexOf('test2');

Upvotes: 2

Related Questions