getByIndex method
Danger<VT, IterablePatternExceptionABC>
getByIndex(
- int index
)
inherited
Implementation
Danger<VT, IterablePatternExceptionABC> getByIndex(int index) {
final log = Log(classLocation: runtimeType, functionLocation: 'getByIndex');
if (isEmpty) return Failure(IterablePatternExceptionC(), log);
if (index < 0) return Failure(IterablePatternExceptionA(), log.monitor({'index': index}));
if (length < index + 1) return Failure(IterablePatternExceptionB(), log.monitor({
'index': index,
'length': length,
}));
final result = elementAt(index);
return Success(result, log);
}