Closed SrujanMungara closed 2 years ago
Hi, You can perform a rollback just like below:
await MyDbModel().batchStart();
try {
for (final obj in productList) {
await obj.save(ignoreBatch: false); // Remember, if you use CRUD methods without the ignoreBatch parameter
// it will be sent default with true,
// so it causes to perform the action out of the transaction
}
final List<dynamic>? result = await MyDbModel().batchCommit();
} catch (e) {
MyDbModel().batchRollback();
}
Thank you. it has worked
How can i perform a rollback on a transactional DB?