ensureLocalization method

Future<void> ensureLocalization({
  1. bool syncDependencies = true,
})

Ensures that the project is configured for Flutter localization.

Adds the required localization dependencies, enables Flutter code generation, and saves the updated pubspec.yaml file.

Implementation

Future<void> ensureLocalization({
  bool syncDependencies = true,
}) async {
  await _ensureLoaded();
  await ensureFlutterSdkDependency('flutter_localizations');
  await ensureDependency('intl');
  await ensureFlutterGenerate();
  if (syncDependencies) await save();
}