getPendingOps method

  1. @override
Future<List<PendingOp<T, Id>>> getPendingOps(
  1. SyncScope scope
)
override

Implementation

@override
Future<List<store.PendingOp<T, Id>>> getPendingOps(SyncScope scope) async {
  final sk = _scopeKey(scope);
  final q = db.select(db.pendingOps)
    ..where((t) => t.scopeName.equals(scope.name) & t.scopeKeys.equals(sk));
  final rows = await q.get();
  return rows
      .map(
        (r) => store.PendingOp<T, Id>(
          opId: r.opId,
          scope: scope,
          type: _parseType(r.type),
          id: idFromString(r.id),
          payload: r.payload == null
              ? null
              : fromJson(jsonDecode(r.payload!) as Map<String, dynamic>),
          updatedAt: DateTime.parse(r.updatedAt).toUtc(),
        ),
      )
      .toList(growable: false);
}