all method

Future<List<Credentials>> all()

Returns all the Credentials stored in the database.

Implementation

Future<List<Credentials>> all() async {
  final result = await safe((db) async {
    final stmt = await db.select(db.tokens).get();
    return stmt
        .map((c) {
          try {
            return _CredentialsDb.fromDb(c);
          } catch (e) {
            Log.error('Unable to decode `Credentials`: $e', '$runtimeType');
            Log.error(
              'The credentials stored are: `${c.credentials}`',
              '$runtimeType',
            );
            return null;
          }
        })
        .nonNulls
        .toList();
  }, exclusive: false);

  return result ?? [];
}