getDownloadedNames method
Implementation
Future<List<String>?> getDownloadedNames(List<String> tags) async {
if (tags.isEmpty) {
return null;
}
final OpenFoodFactsLanguage language = getLanguage();
final Map<String, T>? map = await download(tags);
if (map == null) {
return null;
}
final List<String> result = <String>[];
for (final String tag in tags) {
String? toBeAdded;
final T? item = map[tag];
if (item != null) {
final Map<OpenFoodFactsLanguage, String>? names = getTaxonomyNames(
item,
);
if (names != null && names.isNotEmpty) {
final String? label = names[language];
if (label != null) {
_setCachedName(tag, label);
toBeAdded = label;
}
}
}
toBeAdded ??= tag;
result.add(toBeAdded);
}
return result;
}