24 lines
677 B
Dart
24 lines
677 B
Dart
import 'package:aitrainer_app/model/cache.dart';
|
|
import 'package:aitrainer_app/model/description.dart';
|
|
|
|
class DescriptionRepository {
|
|
List<Description>? descriptions;
|
|
|
|
DescriptionRepository() {
|
|
this.descriptions = Cache().getDescriptions();
|
|
}
|
|
|
|
String getDescriptionByName(String name) {
|
|
String descriptionText = "";
|
|
if (descriptions != null) {
|
|
this.descriptions!.forEach((element) {
|
|
print("Desc ${element.name} - $name");
|
|
if (element.name == name) {
|
|
descriptionText = element.descriptionTranslation != null ? element.descriptionTranslation! : element.description;
|
|
}
|
|
});
|
|
}
|
|
return descriptionText;
|
|
}
|
|
}
|