checkActive method Null safety

dynamic checkActive(
  1. EngineSettings settings
)

Check if the current language matches the downloaded language pack If not, download and activate it

Implementation

checkActive(EngineSettings settings) async {
  // Load packages
  await loadPackages();

  if (packages.isEmpty) return;

  // Get the pack for the language and region
  var packForLanguageAndRegion = await getPackForSettings(settings);
  Get.log('[$runtimeType] Speech pack for language and region: '
      '${packForLanguageAndRegion.copyWith(conditions: [])}');

  // Stop all current downloads
  _downloadCtrl.stopCurrentDownload();

  // Start download and activation
  if (!activePackageStatus.isActivated || activePackageStatus.isUpdated) {
    await downloadAndActivate(packForLanguageAndRegion);
  } else {
    await setupActivePack(packForLanguageAndRegion);
  }

  // Sync place holders
}