dispose method
Stops the synchronization and closes the database. After this you can safely make this Client instance null.
Implementation
Future<void> dispose({bool closeDatabase = true}) async {
_disposed = true;
await abortSync();
await encryption?.dispose();
encryption = null;
try {
if (closeDatabase) {
final database = _database;
_database = null;
await database
?.close()
.catchError((e, s) => Logs().w('Failed to close database: ', e, s));
}
} catch (error, stacktrace) {
Logs().w('Failed to close database: ', error, stacktrace);
}
return;
}