DVOfflineStore constructor

DVOfflineStore({
  1. required DVRecordTable table,
  2. required DVOffline policy,
  3. DVOfflineClock? clock,
  4. bool? persistent,
  5. void onAdopted(
    1. DVRecord record
    )?,
})

Implementation

DVOfflineStore({
  required this.table,
  required this.policy,
  DVOfflineClock? clock,
  bool? persistent,
  this.onAdopted,
})  : clock = clock ?? DVOfflineClock(),
      persistent = persistent ?? table.database is! MemoryDVDatabaseAdapter {
  if (!policy.strategy.allowedOffline) {
    throw DVOfflineStrategyError(policy.strategy);
  }
  this.clock
    .._tolerance = policy.maxClockSkew
    .._onSkew = (Duration offset) => _report(
          'DV-OFFLINE-004',
          'The device clock is ${offset.inMinutes.abs()} minutes '
              '${offset.isNegative ? 'ahead of' : 'behind'} the server; '
              'writes are stamped with corrected time.',
          DVLogLevel.warn,
        );
}