getDiseasesByVector method
- String speciesName,
- AppLocalizations localizations
Gets all diseases associated with a specific mosquito vector
speciesName: The name of the mosquito specieslocalizations: Localization instance for error messages
Returns a list of diseases associated with the vector, or an empty list if an error occurs
Implementation
Future<List<Disease>> getDiseasesByVector(
String speciesName,
AppLocalizations localizations,
) async {
try {
if (_state != DiseaseInfoState.loaded &&
_state != DiseaseInfoState.loading) {
await loadDiseases(localizations);
}
return await _repository.getDiseasesByVector(
speciesName,
localizations.localeName,
);
} catch (e) {
_errorMessage = localizations.viewModelErrorFailedToLoadDiseasesForVector(
e.toString(),
);
notifyListeners();
return [];
}
}