deleteLocale method

Future<void> deleteLocale(
  1. String locale,
  2. BuildContext? context
)

Deletes a locale file permanently.

Implementation

Future<void> deleteLocale(String locale, BuildContext? context) async {
  // 1. Optimistic update - immediate UI feedback
  queue.removeLocaleOptimistic(locale);
  notifyListeners();

  try {
    await _client.deleteLocale(locale: locale);
  } catch (e) {
    // 2. On error: rollback and refresh
    await queue.refresh(reloadMeta: true);
    notifyListeners();
    // Error will be shown by the caller
    rethrow;
  }
}