insert<T extends TableBase> method

Future<int?> insert<T extends TableBase>(
  1. T obj,
  2. bool ignoreBatch
)

Implementation

Future<int?> insert<T extends TableBase>(T obj, bool ignoreBatch) async {
  try {
    /// Leave it in this format for Throw to stay in this catch
    final res = await insertOrThrow(obj, ignoreBatch);
    return res;
  } catch (error, stackTrace) {
    obj.saveResult = BoolResult(
        success: false,
        errorMessage:
            '$_tableName-> Save failed. Error: ${error.toString()}');
    _dbModel?.logFunction?.call(Log(
        msg: '$_tableName -> Save failed. Error: ${error.toString()}',
        error: error,
        stackTrace: stackTrace));
    return null;
  }
}