getLocales method Null safety

  1. @protected
Future<List<String>> getLocales(
  1. L10nConfig config
)

Implementation

@protected
Future<List<String>> getLocales(L10nConfig config) async {
  final baseDirPath = config.xmlOutputDir;
  final baseDir = Directory(baseDirPath);
  final baseLocale = config.baseLocaleForXml;

  final locales = <String>[];
  await for (final item in baseDir.list()) {
    if (item is Directory) {
      final name = path.basename(item.path);
      if (name != baseLocale && _isLocaleName(name)) locales.add(name);
    }
  }

  locales.sort();

  return locales;
}