elementAtOrNull method
Deprecation hint: Read the migration guide for more details on migrating.
Returns the index
th element.
If the index is out of bounds it will return null
.
Example:
['a', 'b'].elementAtOrNull(2); // null
Implementation
T? elementAtOrNull(int index) {
try {
return elementAt(index);
} catch (error) {
return null;
}
}