clear method

Future<void> clear()

Resets all settings and stops the synchronisation.

Implementation

Future<void> clear() async {
  Logs().outputEvents.clear();
  try {
    await abortSync();
    await database?.clear();
    _backgroundSync = true;
  } catch (e, s) {
    Logs().e('Unable to clear database', e, s);
  } finally {
    _database = null;
  }

  _id = accessToken = syncFilterId =
      homeserver = _userID = _deviceID = _deviceName = prevBatch = null;
  _rooms = [];
  _eventsPendingDecryption.clear();
  await encryption?.dispose();
  encryption = null;
  onLoginStateChanged.add(LoginState.loggedOut);
}