deleteLocalizations method

  1. @override
Future<bool> deleteLocalizations(
  1. Locale locale
)
override

Delete the localization for the locale.

Returns true if successful, false otherwise.

Implementation

@override
Future<bool> deleteLocalizations(Locale locale) async {
  _assertCarpService();
  info(
      'Deleting language locale from path : ${_getLocalizationsPath(locale)}');

  DocumentReference reference =
      CarpService().document(_getLocalizationsPath(locale));
  await reference.delete();
  DocumentSnapshot? document =
      await CarpService().document(_getLocalizationsPath(locale)).get();

  // also trying to delete local cached version
  try {
    File(await _cacheLocalizationFilename(locale)).deleteSync();
  } catch (exception) {
    warning(
        "Failed to delete local cache of localization for '$locale' - $exception");
  }

  return (document == null);
}