update drift to 2.7.0

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2023-04-20 18:41:51 +05:30
committed by xsahil03x
parent a1a4e55e75
commit fc05a9a4cf
28 changed files with 2021 additions and 1740 deletions
@@ -1,6 +1,5 @@
import 'package:drift/drift.dart';
import 'package:stream_chat/stream_chat.dart';
import 'package:stream_chat_persistence/src/converter/converter.dart';
import 'package:stream_chat_persistence/src/dao/dao.dart';
import 'package:stream_chat_persistence/src/entity/entity.dart';
@@ -37,18 +36,12 @@ part 'drift_chat_database.g.dart';
],
)
class DriftChatDatabase extends _$DriftChatDatabase {
/// Creates a new moor chat database instance
/// Creates a new drift chat database instance
DriftChatDatabase(
this._userId,
QueryExecutor executor,
) : super(executor);
/// Instantiate a new database instance
DriftChatDatabase.connect(
this._userId,
DatabaseConnection connection,
) : super.connect(connection);
final String _userId;
/// User id to which the database is connected
File diff suppressed because it is too large Load Diff
@@ -23,7 +23,7 @@ class SharedDB {
}) async {
final dbName = 'db_$userId';
if (connectionMode == ConnectionMode.background) {
return DriftChatDatabase.connect(
return DriftChatDatabase(
userId,
DatabaseConnection.delayed(Future(() async {
final isolate = await _createMoorIsolate(
@@ -34,6 +34,7 @@ class SharedDB {
})),
);
}
return DriftChatDatabase(
userId,
LazyDatabase(
@@ -68,7 +69,7 @@ class SharedDB {
logStatements: request.logStatements,
));
final moorIsolate = DriftIsolate.inCurrent(
() => DatabaseConnection.fromExecutor(executor),
() => DatabaseConnection(executor),
);
request.sendMoorIsolate.send(moorIsolate);
}