sync method

Future<void> sync(
  1. bool force
)

Synchronizes the environment to disk.

Parameters:

  • force - If true, forces a synchronous flush

Use this to ensure all changes are written to disk.

Example:

// Normal async sync
await db.sync(false);

// Force immediate sync
await db.sync(true);

Implementation

Future<void> sync(bool force) async {
  final currentEnv = env;
  final result = _lib.mdb_env_sync(currentEnv, force ? 1 : 0);
  if (result != 0) {
    throw LMDBException('Failed to sync environment', result);
  }
}