list method

Every grant, oldest first.

Implementation

Future<List<DVStudioGrant>> list() async {
  await _ensure();
  final List<Map<String, Object?>> rows = await _records.find(
    table,
    orderBy: const <DVSort>[DVSort('granted_at')],
  );
  return <DVStudioGrant>[
    for (final Map<String, Object?> row in rows)
      (
        userId: '${row['user_id']}',
        tenant: '${row['tenant']}',
        grantedAt: DateTime.fromMillisecondsSinceEpoch(
            (row['granted_at'] as num?)?.toInt() ?? 0,
            isUtc: true),
      ),
  ];
}