getDiseaseById method

Future<Disease?> getDiseaseById(
  1. String id,
  2. AppLocalizations localizations
)

Gets a disease by its ID

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

Returns the disease if found, or null if an error occurs

Implementation

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