insert method

void insert({
  1. String? where,
  2. List<Object?>? whereArgs,
  3. BoxerOptionType join = BoxerOptionType.AND,
  4. bool isInsertInFront = false,
})

Implementation

void insert({
  String? where,
  List<Object?>? whereArgs,
  BoxerOptionType join = BoxerOptionType.AND,
  bool isInsertInFront = false,
}) {
  if (where == null || (where = where.trim()).isEmpty) return;

  /// insert where
  String? _where = this.where;
  if (_where == null || (_where = _where.trim()).isEmpty) {
    this.where = where;
  } else {
    this.where = joinWith(isInsertInFront ? [where, _where] : [_where, where], join);
  }

  /// insert where arguments
  if (whereArgs != null && whereArgs.isNotEmpty) {
    List<Object?> _whereArgs = List<Object?>.from(this.whereArgs ??= []);
    isInsertInFront ? _whereArgs.insertAll(0, whereArgs) : _whereArgs.addAll(whereArgs);
    this.whereArgs = _whereArgs;
  }
}