read<T extends Object> method

T read<T extends Object>(
  1. String name
)

Reads an arbitrary value from the row and maps it to a fitting dart type.

The dart type T must be supported by the type system of the database used (mostly contains booleans, strings, numbers and dates).

Implementation

T read<T extends Object>(String name) {
  final type = BuiltinSqlType.forType<T>();
  if (type == null) {
    throw ArgumentError(
      'Tried to call read() with an unknown type ($T). For '
      'builtin types (String, int, BigInt, double, Uint8List, bool, DateTime, '
      'DatabaseJson), try adding a type argument. For other types, use '
      'readWithType.',
    );
  }

  return readWithType(
    BuiltinSqlType.forType<T>()!.resolveIn(_db.dialect),
    name,
  );
}