Database transaction workaround

This commit is contained in:
Christian Pauly 2020-06-19 15:28:03 +02:00
parent b8c6decafc
commit f1579a5f0f

View file

@ -20,6 +20,18 @@ class Database extends _$Database {
int get maxFileSize => 1 * 1024 * 1024;
@override
Future<T> transaction<T>(Future<T> Function() action) async {
try {
await super.transaction(() async {
await customSelect('SELECT 1').get();
});
} catch (_) {
return action();
}
return super.transaction(action);
}
@override
MigrationStrategy get migration => MigrationStrategy(
onCreate: (Migrator m) {