parse<T, DB> method

T parse<T, DB>(
  1. String key,
  2. T parser(
    1. DB dbValue
    )
)

Reads a primitive database value DB and parses it into a custom type T. Throws if the column is null, missing from schema, or if parsing fails.

Implementation

T parse<T, DB>(String key, T Function(DB dbValue) parser) {
  final dbValue = get<DB>(key);
  return parser(dbValue);
}