loadPackages method Null safety
Load the packages from the web
Implementation
Future<void> loadPackages() async {
if (packages.isEmpty) {
// Get the packages
final packs = await _syncModelController.get();
packages.addAll(packs ?? []);
// Update the available regions for user selection
final locales = List<Locale>.from(
packages.map((pack) => LanguageService.localeFor(pack.lang)),
);
if (locales.isNotEmpty) {
LanguageService.updateLocales(locales);
}
}
}