find method

Entry? find(
  1. bool cb(
    1. Entry entry,
    2. int index
    )
)

Finds an entry in the list that matches the given condition.

The cb parameter is a callback function that returns true for the matching entry. Returns the Entry that matches the condition, or null if no match is found.

Implementation

Entry? find(bool Function(Entry entry, int index) cb) {
  for (int i = 0; i < length; i++) {
    final item = getEntryByIndex(i);
    if (cb(item, i)) return item;
  }
  return null;
}