sqlInsertIfNotExists method

  1. @Deprecated("The insertIfNotExists function will be removed after version 4.4.0")
Future<int?> sqlInsertIfNotExists({
  1. bool verbose = false,
})

Insert a row in the database table if it does not exist already

Implementation

@Deprecated(
    "The insertIfNotExists function will be removed after version 4.4.0")
Future<int?> sqlInsertIfNotExists({bool verbose = false}) async {
  _checkDbIsReady();
  final data = this.toDb();
  final row = _toStringsMap(data);
  final id = await db!
      .insertIfNotExists(table: table!.name, row: row, verbose: verbose)
      .catchError((dynamic e) =>
          throw WriteQueryException("Can not insert model into database $e"));
  return id;
}