clearAll method

Future<void> clearAll()

Implementation

Future<void> clearAll() async {
  try {
    _stateSubject.add(currentState.copyWith(isLoading: true));

    await Future.wait([
      auth.clearAuth(),
      secure.deleteAll(),
      prefs.deleteAll(),
      images.clearCache(),
    ]);

    _stateSubject.add(StorageState(
      isInitialized: true,
      isLoading: false,
      lastClearedAt: DateTime.now(),
    ));
  } catch (e) {
    _stateSubject.add(currentState.copyWith(
      error: 'Error limpiando todo: $e',
      isLoading: false,
    ));
    rethrow;
  }
}