getTopAlternatives method
- int count = 3
Gets the top N alternative species predictions.
Returns a list of species names sorted by probability (excluding the top prediction). Useful for showing users alternative possibilities when confidence is moderate.
Example:
final alternatives = result.getTopAlternatives(3);
// ['Aedes albopictus', 'Culex pipiens', 'Anopheles gambiae']
Implementation
List<String> getTopAlternatives([int count = 3]) {
final sorted = probabilities.entries.toList()
..sort((a, b) => b.value.compareTo(a.value));
return sorted
.skip(1) // Skip the top prediction
.take(count)
.map((entry) => entry.key)
.toList();
}