createReturningOrNull method

Future<$Dataclass?> createReturningOrNull(
  1. Insertable<$Dataclass> f(
    1. $CreateCompanionCallback o
    ), {
  2. InsertMode? mode,
  3. UpsertClause<$Table, $Dataclass>? onConflict,
})

Inserts a row into the table and returns it.

When no row was inserted and no exception was thrown, for instance because InsertMode.insertOrIgnore was used or because the upsert clause had a where clause that didn't match, null is returned instead.

Implementation

Future<$Dataclass?> createReturningOrNull(
    Insertable<$Dataclass> Function($CreateCompanionCallback o) f,
    {InsertMode? mode,
    UpsertClause<$Table, $Dataclass>? onConflict}) {
  return $state.db.into($state._tableAsTableInfo).insertReturningOrNull(
      f($state._createCompanionCallback),
      mode: mode,
      onConflict: onConflict);
}