deleteLike method Null safety

Future<void> deleteLike(
  1. String key,
  2. {Batch? batch}
)

Implementation

Future<void> deleteLike(String key, {Batch? batch}) async {
  bool doCommit = false;
  if (batch == null) {
    doCommit = true;
    batch = await startBatch();
  }

  batch.delete(
    _table,
    where: 'key like ?',
    whereArgs: [key],
  );

  if (doCommit) {
    await commitBatch(batch);
  }
}