Feat: Stellt den BackgroundManager auf IsolateManager um

This commit is contained in:
2026-01-03 21:53:37 +01:00
parent baef163b68
commit 7b3a1cfac6
11 changed files with 15625 additions and 107 deletions

View File

@@ -102,5 +102,6 @@ class AppDatabase extends _$AppDatabase {
sqlite3Wasm: Uri.parse('sqlite3.wasm'),
driftWorker: Uri.parse('drift_worker.js'),
),
native: const DriftNativeOptions(shareAcrossIsolates: true)
);
}

View File

@@ -577,8 +577,7 @@ class RecurringTransaction extends DataClass
String toString() {
return (StringBuffer('RecurringTransaction(')
..write('id: $id, ')
..write('name: $name, ')
..write('startDate: $startDate, ')..write(
..write('name: $name, ')..write('startDate: $startDate, ')..write(
'timeFrame: $timeFrame, ')..write('amount: $amount, ')..write(
'accountId: $accountId, ')..write('updatedAt: $updatedAt')
..write(')'))
@@ -702,8 +701,7 @@ class RecurringTransactionsCompanion
String toString() {
return (StringBuffer('RecurringTransactionsCompanion(')
..write('id: $id, ')
..write('name: $name, ')
..write('startDate: $startDate, ')..write(
..write('name: $name, ')..write('startDate: $startDate, ')..write(
'timeFrame: $timeFrame, ')..write('amount: $amount, ')..write(
'accountId: $accountId, ')..write('updatedAt: $updatedAt')
..write(')'))
@@ -1076,11 +1074,14 @@ class Transaction extends DataClass implements Insertable<Transaction> {
@override
String toString() {
return (StringBuffer('Transaction(')
..write('id: $id, ')..write('name: $name, ')..write(
'date: $date, ')..write('amount: $amount, ')..write(
'checked: $checked, ')..write('accountId: $accountId, ')..write(
'recurringTransactionId: $recurringTransactionId, ')..write(
'updatedAt: $updatedAt')
..write('id: $id, ')
..write('name: $name, ')
..write('date: $date, ')
..write('amount: $amount, ')
..write('checked: $checked, ')
..write('accountId: $accountId, ')
..write('recurringTransactionId: $recurringTransactionId, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@@ -1220,11 +1221,15 @@ class TransactionsCompanion extends UpdateCompanion<Transaction> {
@override
String toString() {
return (StringBuffer('TransactionsCompanion(')
..write('id: $id, ')..write('name: $name, ')..write(
'date: $date, ')..write('amount: $amount, ')..write(
'checked: $checked, ')..write('accountId: $accountId, ')..write(
'recurringTransactionId: $recurringTransactionId, ')..write(
'updatedAt: $updatedAt')..write(')'))
..write('id: $id, ')
..write('name: $name, ')
..write('date: $date, ')
..write('amount: $amount, ')
..write('checked: $checked, ')
..write('accountId: $accountId, ')
..write('recurringTransactionId: $recurringTransactionId, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
}
@@ -1233,9 +1238,7 @@ class $SyncLogTable extends SyncLog with TableInfo<$SyncLogTable, SyncLogData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$SyncLogTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<int> id = GeneratedColumn<int>(
@@ -1251,13 +1254,13 @@ class $SyncLogTable extends SyncLog with TableInfo<$SyncLogTable, SyncLogData> {
);
@override
late final GeneratedColumnWithTypeConverter<SyncLogTypeEnum, int> type =
GeneratedColumn<int>(
'type',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
).withConverter<SyncLogTypeEnum>($SyncLogTable.$convertertype);
GeneratedColumn<int>(
'type',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
).withConverter<SyncLogTypeEnum>($SyncLogTable.$convertertype);
static const VerificationMeta _descriptionMeta = const VerificationMeta(
'description',
);
@@ -1282,19 +1285,16 @@ class $SyncLogTable extends SyncLog with TableInfo<$SyncLogTable, SyncLogData> {
requiredDuringInsert: false,
defaultValue: currentDateAndTime,
);
@override
List<GeneratedColumn> get $columns => [id, type, description, updatedAt];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'sync_log';
@override
VerificationContext validateIntegrity(Insertable<SyncLogData> instance, {
VerificationContext validateIntegrity(
Insertable<SyncLogData> instance, {
bool isInserting = false,
}) {
final context = VerificationContext();
@@ -1322,7 +1322,6 @@ class $SyncLogTable extends SyncLog with TableInfo<$SyncLogTable, SyncLogData> {
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
SyncLogData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
@@ -1354,7 +1353,7 @@ class $SyncLogTable extends SyncLog with TableInfo<$SyncLogTable, SyncLogData> {
}
static JsonTypeConverter2<SyncLogTypeEnum, int, int> $convertertype =
const EnumIndexConverter<SyncLogTypeEnum>(SyncLogTypeEnum.values);
const EnumIndexConverter<SyncLogTypeEnum>(SyncLogTypeEnum.values);
}
class SyncLogData extends DataClass implements Insertable<SyncLogData> {
@@ -1369,14 +1368,12 @@ class SyncLogData extends DataClass implements Insertable<SyncLogData> {
/// Wann dieser SyncLog das letzte mal geupdated wurde
final DateTime updatedAt;
const SyncLogData({
required this.id,
required this.type,
required this.description,
required this.updatedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
@@ -1398,7 +1395,8 @@ class SyncLogData extends DataClass implements Insertable<SyncLogData> {
);
}
factory SyncLogData.fromJson(Map<String, dynamic> json, {
factory SyncLogData.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
@@ -1411,7 +1409,6 @@ class SyncLogData extends DataClass implements Insertable<SyncLogData> {
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
@@ -1428,14 +1425,12 @@ class SyncLogData extends DataClass implements Insertable<SyncLogData> {
SyncLogTypeEnum? type,
String? description,
DateTime? updatedAt,
}) =>
SyncLogData(
id: id ?? this.id,
type: type ?? this.type,
description: description ?? this.description,
updatedAt: updatedAt ?? this.updatedAt,
);
}) => SyncLogData(
id: id ?? this.id,
type: type ?? this.type,
description: description ?? this.description,
updatedAt: updatedAt ?? this.updatedAt,
);
SyncLogData copyWithCompanion(SyncLogCompanion data) {
return SyncLogData(
id: data.id.present ? data.id.value : this.id,
@@ -1450,23 +1445,24 @@ class SyncLogData extends DataClass implements Insertable<SyncLogData> {
@override
String toString() {
return (StringBuffer('SyncLogData(')
..write('id: $id, ')..write('type: $type, ')..write(
'description: $description, ')..write('updatedAt: $updatedAt')..write(
')'))
..write('id: $id, ')
..write('type: $type, ')
..write('description: $description, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(id, type, description, updatedAt);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is SyncLogData &&
other.id == this.id &&
other.type == this.type &&
other.description == this.description &&
other.updatedAt == this.updatedAt);
(other is SyncLogData &&
other.id == this.id &&
other.type == this.type &&
other.description == this.description &&
other.updatedAt == this.updatedAt);
}
class SyncLogCompanion extends UpdateCompanion<SyncLogData> {
@@ -1474,21 +1470,18 @@ class SyncLogCompanion extends UpdateCompanion<SyncLogData> {
final Value<SyncLogTypeEnum> type;
final Value<String> description;
final Value<DateTime> updatedAt;
const SyncLogCompanion({
this.id = const Value.absent(),
this.type = const Value.absent(),
this.description = const Value.absent(),
this.updatedAt = const Value.absent(),
});
SyncLogCompanion.insert({
this.id = const Value.absent(),
required SyncLogTypeEnum type,
this.description = const Value.absent(),
this.updatedAt = const Value.absent(),
}) : type = Value(type);
static Insertable<SyncLogData> custom({
Expression<int>? id,
Expression<int>? type,
@@ -1540,8 +1533,10 @@ class SyncLogCompanion extends UpdateCompanion<SyncLogData> {
@override
String toString() {
return (StringBuffer('SyncLogCompanion(')
..write('id: $id, ')..write('type: $type, ')..write(
'description: $description, ')..write('updatedAt: $updatedAt')
..write('id: $id, ')
..write('type: $type, ')
..write('description: $description, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@@ -2905,7 +2900,6 @@ class $$SyncLogTableFilterComposer
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<int> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
@@ -2937,7 +2931,6 @@ class $$SyncLogTableOrderingComposer
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<int> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
@@ -2968,7 +2961,6 @@ class $$SyncLogTableAnnotationComposer
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<int> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
@@ -3069,7 +3061,6 @@ class $AppDatabaseManager {
$$RecurringTransactionsTableTableManager(_db, _db.recurringTransactions);
$$TransactionsTableTableManager get transactions =>
$$TransactionsTableTableManager(_db, _db.transactions);
$$SyncLogTableTableManager get syncLog =>
$$SyncLogTableTableManager(_db, _db.syncLog);
}