firstAs<T> method

T? firstAs<T>(
  1. T mapper(
    1. Map<String, dynamic> row
    )
)

Returns the first row mapped to T, or null if the result is empty.

final user = result.firstAs(User.fromJson);

Implementation

T? firstAs<T>(T Function(Map<String, dynamic> row) mapper) {
  final row = first;
  return row != null ? mapper(row) : null;
}