binarySearch method Null safety

int binarySearch(
  1. E element,
  2. int compare(
    1. E,
    2. E
    )
)

Returns the index of element in this sorted list.

Uses binary search to find the location of element. The list must be sorted according to compare, otherwise the result is unspecified

Returns -1 if element does not occur in this list.

Implementation

int binarySearch(E element, int Function(E, E) compare) =>
    algorithms.binarySearchBy<E, E>(this, identity, compare, element);