import 'package:collection/collection.dart'; void main() { print([-1, 0, 1, 2, 3, 4, 5].binarySearch(1, (p0, p1) => p0.compareTo(p1))); // 2 }