pickNativeMatch<T> function
Picks the match to tap: the one at index (0-based, screen order, like
fdb tap --index), or the only match when index is null.
Implementation
NativeMatchPick<T> pickNativeMatch<T>(List<T> matches, {required int? index}) {
if (matches.isEmpty) return NativeMatchNone<T>();
if (index != null) {
return index >= 0 && index < matches.length ? NativeMatchPicked<T>(matches[index]) : NativeMatchNone<T>();
}
if (matches.length == 1) return NativeMatchPicked<T>(matches.single);
return NativeMatchAmbiguous<T>(matches);
}