clearData static method

Future<void> clearData({
  1. required String baseUrl,
  2. required String inboxIdentifier,
  3. String? userIdentifier,
})

Clears all persisted DOO data on device for a particular DOO client instance. See getClientInstanceKey on how DOO client instance are differentiated

Implementation

static Future<void> clearData(
    {required String baseUrl,
    required String inboxIdentifier,
    String? userIdentifier}) async {
  final clientInstanceKey = getClientInstanceKey(
      baseUrl: baseUrl,
      inboxIdentifier: inboxIdentifier,
      userIdentifier: userIdentifier);
  providerContainerMap.putIfAbsent(
      clientInstanceKey, () => ProviderContainer());
  final container = providerContainerMap[clientInstanceKey]!;
  final params = DOOParameters(
      isPersistenceEnabled: true,
      baseUrl: "",
      inboxIdentifier: "",
      clientInstanceKey: "");

  final localStorage = container.read(localStorageProvider(params));
  await localStorage.clear();

  localStorage.dispose();
  container.dispose();
  providerContainerMap.remove(clientInstanceKey);
}