get method

  1. @override
Future<DateTime> get(
  1. String table
)
override

Get the last sync time for a table. Returns epoch if never synced.

Implementation

@override
Future<DateTime> get(String table) async {
  final rows = await _db.customSelect(
    'SELECT last_synced_at FROM dynos_sync_timestamps WHERE table_name = ?',
    variables: [Variable.withString(table)],
  ).get();

  if (rows.isEmpty) return _epoch;
  return DateTime.fromMillisecondsSinceEpoch(
    rows.first.read<int>('last_synced_at'),
    isUtc: true,
  );
}