Fix for activating mongodb connection

This commit is contained in:
Морозов Андрей 2022-09-24 22:17:36 +04:00
parent 813658f934
commit 741b904fd8
4 changed files with 14 additions and 15 deletions

View File

@ -16,7 +16,7 @@ class DataSingleton {
List<String> gridData = [""];
Map<String, Color> coloredLetters = {};
int currentWordIndex = 0;
late DBConnection _mongo;
final DBConnection _mongo = DBConnection();
factory DataSingleton() {
return _dataSingleton;
@ -81,6 +81,7 @@ class DataSingleton {
}
} else {
_mongo.insertWord(secretWord, false);
_mongo.loseConnection();
return LoseGameState();
}
}

View File

@ -17,6 +17,10 @@ class DBConnection {
final String _dbName = "DATABASE NAME";
final String _collectionName = "WordsTable";
DBConnection() {
startConnection();
}
late Db _db;
late final DbCollection _collection = _db.collection(_collectionName);

View File

@ -14,7 +14,7 @@ packages:
name: basic_utils
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.2"
version: "3.9.4"
bloc:
dependency: "direct main"
description:
@ -30,12 +30,12 @@ packages:
source: hosted
version: "2.1.0"
bson:
dependency: transitive
dependency: "direct main"
description:
name: bson
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "1.0.4"
buffer:
dependency: transitive
description:
@ -92,13 +92,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
decimal:
dependency: transitive
description:
name: decimal
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
desktop_window:
dependency: "direct main"
description:
@ -274,14 +267,14 @@ packages:
name: mongo_dart
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.0-1.0.beta"
version: "0.7.4+1"
mongo_dart_query:
dependency: transitive
description:
name: mongo_dart_query
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "1.0.2"
nested:
dependency: transitive
description:
@ -421,7 +414,7 @@ packages:
name: rational
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "1.2.1"
sasl_scram:
dependency: transitive
description:

View File

@ -23,7 +23,8 @@ dependencies:
fullscreen: ^1.0.3
file: ^6.1.4
bloc: ^8.1.0
mongo_dart: ^0.8.0-1.0.beta
mongo_dart: ^0.7.4+1
bson: ^1.0.4
dev_dependencies:
flutter_test: