From 0e740eba164d6319c6088b6de8edc215fd3131ef Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Mon, 9 Nov 2020 17:39:10 +0100 Subject: [PATCH] added noResult param to batch.commit to speed it up --- lib/pages/practice/PracticeDatabase.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pages/practice/PracticeDatabase.dart b/lib/pages/practice/PracticeDatabase.dart index db159a8..160b136 100644 --- a/lib/pages/practice/PracticeDatabase.dart +++ b/lib/pages/practice/PracticeDatabase.dart @@ -1,8 +1,12 @@ +import 'dart:async'; +import 'dart:core'; + import 'package:ohthatsa/pages/practice/PracticeAnswer.dart'; import 'package:ohthatsa/pages/practice/PracticeType.dart'; import 'package:sqflite/sqflite.dart'; import 'package:path/path.dart'; + class PracticeDatabase { static _onCreate(Database database, int version) async { String types = PracticeType.values.map((type) => "'${type.toString().split(".").last}'").join(", "); @@ -48,6 +52,6 @@ class PracticeDatabase { answer.sessionId = sessionId; batch.insert("PracticeAnswer", answer.toMap()); }); - await batch.commit(); + await batch.commit(noResult: true); } } \ No newline at end of file