getAndMap method
Gets the index
th element, and then apply the map
function to it, returning the result.
If that index doesn't exist (negative, or out of range), will the map
method
will be called with inRange
false and value
null.
Implementation
T getAndMap(
int index,
T Function(int index, bool inRange, T? value) map,
) {
bool inRange = (index >= 0 && index < _l.length);
T? value = inRange ? _l[index] : null;
return map(index, inRange, value);
}