toList method

Future<List<T>> toList({
  1. Map<QueryParameter, Object?> parameters = const {},
})

Implementation

Future<List<T>> toList(
    {Map<QueryParameter<dynamic>, Object?> parameters = const {}}) {
  try {
    if (_closed) throw const OrmStateException('Prepared query closed');
    final bound = _bindPrepared(_template._parameters, parameters);
    return owner._run(() async {
      if (_closed) throw const OrmStateException('Prepared query closed');
      final result = await _command.query(bound);
      return [for (final row in result.rows) _query._read(result, row)];
    });
  } catch (error, stack) {
    return Future.error(error, stack);
  }
}