execute method

Future<void> execute()

Implementation

Future<void> execute() async {
  final project = _configManager.project;
  if (project == null) {
    throw Exception('IllegalState: project is not set');
  }

  await Future.wait((project.targetLocales ?? []).map((locale) async {
    stdout.writeln('📥 Fetching $locale');
    final jsonString = await _resourcesApi.downloadResourcesFile(
      projectId: project.id,
      locale: locale,
      format: 'arb',
    );
    await _fileManager.writeLocalizationFile(locale, jsonString);
  }));
}