delete method

  1. @override
Future delete(
  1. T? item
)
override

Method delete deletes entry on database

Implementation

@override
Future<dynamic> delete(T? item) async {
  final values = converter.decode(item);

  where({schema.primaryKey: values.remove(schema.primaryKey)});

  final builder = SqlBuilder.delete(
    schema.table!,
    where: _whereQuery,
    whereArgs: _whereArgs,
  );

  final completer = Completer<dynamic>()
    ..complete(database!.rawDelete(builder.sql, builder.arguments));

  if (isLogger!) Logger.destroy(type, completer.future, builder);

  return await completer.future.whenComplete(clear);
}