Answers for "how to check whether index is exist or not in dart"

1

how to check whether index is exist or not in dart

List<int> numbers = [1, 2, 3, 4, 5,];

//Check if index 7 is valid
if (numbers.asMap().containsKey(7)) {
  print('Exists');
} else {
  print('Doesn\'t exist');
}
Posted by: Guest on March-20-2021

Code answers related to "how to check whether index is exist or not in dart"

Browse Popular Code Answers by Language