ShouldCompactCallback typedef

ShouldCompactCallback = bool Function(int totalSize, int usedSize)

The signature of a callback used to determine if compaction should be attempted.

The result of the callback decides if the Realm should be compacted before being returned to the user.

The callback is given two arguments:

  • the totalSize of the realm file (data + free space) in bytes, and
  • the usedSize, which is the number bytes used by data in the file.

It should return true to indicate that an attempt to compact the file should be made. The compaction will be skipped if another process is currently accessing the realm file.

Implementation

typedef ShouldCompactCallback = bool Function(int totalSize, int usedSize);