Add method

Future<void> Add(
  1. T item
)

Add Function For Add Any Item To Table

Add Function will generate a Late Exception Because it's need to OpenBatch To called

await batch.Add(Todo(...));

Implementation

Future<void> Add(T item) async {
  var items = await query.Get();
  var id = table.primrayKeyType == PrimaryKeyEnum.AutoIncrement
      ? (items.isEmpty ? 1 : table.primaryKeyGet(items.last) + 1)
      : table.primaryKeyGet(item);
  table.primaryKeySet(item, id);
  batch.insert(table.tableName, query.toMap(item));
}