Метод indexOf
- E element,
- [int start = 0]
Индекс первого вхождения element в этом списке.
Ищет в списке с индекса start до конца списка. В первый раз, когда встречается объект o, так что o == element, возвращается индекс o.
final notes = <String>['do', 're', 'mi', 're'];
print(notes.indexOf('re')); // 1
final indexWithStart = notes.indexOf('re', 2); // 3 Возвращает -1, если element не найден.
final notes = <String>['do', 're', 'mi', 're'];
final index = notes.indexOf('fa'); // -1 Реализация
int indexOf(E element, [int start = 0]);
© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.18.5/dart-core/List/indexOf.html