getMosquitoSpeciesById method

Future<MosquitoSpecies?> getMosquitoSpeciesById(
  1. String id,
  2. AppLocalizations localizations
)

Gets a mosquito species by its ID

  • id: The ID of the mosquito species to retrieve
  • localizations: Localization instance for error messages

Returns the mosquito species if found, or null if an error occurs

Implementation

Future<MosquitoSpecies?> getMosquitoSpeciesById(
  String id,
  AppLocalizations localizations,
) async {
  try {
    return await _repository.getMosquitoSpeciesById(
      id,
      localizations.localeName,
    );
  } catch (e) {
    _errorMessage = localizations.viewModelErrorFailedToLoadMosquitoSpecies(
      e.toString(),
    );
    notifyListeners();
    return null;
  }
}