From 4a1e0a48253732ed5ab649974ee855c6bf913dba Mon Sep 17 00:00:00 2001 From: Riguz Lee Date: Sat, 30 Mar 2024 20:27:11 +0800 Subject: [PATCH] updated note service --- editing/lib/database/database.g.dart | 598 +++++++++---------- editing/lib/database/tables.drift | 16 +- editing/lib/domain/category.dart | 31 + editing/lib/domain/common.dart | 12 + editing/lib/domain/note.dart | 111 ++++ editing/lib/service/note_service.dart | 37 +- editing/lib/store/note_list.dart | 2 - editing/pubspec.lock | 316 +++++----- editing/test/database/database_test.dart | 26 +- editing/test/services/kdbx_service_test.dart | 7 +- editing/test/services/note_service_test.dart | 46 ++ editing/test/test_util/database_helper.dart | 35 ++ 12 files changed, 726 insertions(+), 511 deletions(-) create mode 100644 editing/lib/domain/category.dart create mode 100644 editing/lib/domain/common.dart create mode 100644 editing/lib/domain/note.dart create mode 100644 editing/test/services/note_service_test.dart create mode 100644 editing/test/test_util/database_helper.dart diff --git a/editing/lib/database/database.g.dart b/editing/lib/database/database.g.dart index 2c2a7de..aa5b1bb 100644 --- a/editing/lib/database/database.g.dart +++ b/editing/lib/database/database.g.dart @@ -21,20 +21,20 @@ class Categories extends Table with TableInfo { type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); - static const VerificationMeta _encryptionTypeMeta = - const VerificationMeta('encryptionType'); - late final GeneratedColumn encryptionType = GeneratedColumn( - 'encryption_type', aliasedName, false, + static const VerificationMeta _encryptTypeMeta = + const VerificationMeta('encryptType'); + late final GeneratedColumn encryptType = GeneratedColumn( + 'encrypt_type', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); - static const VerificationMeta _encryptionArgumentsMeta = - const VerificationMeta('encryptionArguments'); - late final GeneratedColumn encryptionArguments = - GeneratedColumn('encryption_arguments', aliasedName, true, - type: DriftSqlType.string, - requiredDuringInsert: false, - $customConstraints: ''); + static const VerificationMeta _encryptArgumentsMeta = + const VerificationMeta('encryptArguments'); + late final GeneratedColumn encryptArguments = GeneratedColumn( + 'encrypt_arguments', aliasedName, true, + type: DriftSqlType.string, + requiredDuringInsert: false, + $customConstraints: ''); static const VerificationMeta _createTimeMeta = const VerificationMeta('createTime'); late final GeneratedColumn createTime = GeneratedColumn( @@ -50,14 +50,8 @@ class Categories extends Table with TableInfo { requiredDuringInsert: true, $customConstraints: 'NOT NULL'); @override - List get $columns => [ - id, - name, - encryptionType, - encryptionArguments, - createTime, - lastUpdateTime - ]; + List get $columns => + [id, name, encryptType, encryptArguments, createTime, lastUpdateTime]; @override String get aliasedName => _alias ?? actualTableName; @override @@ -77,19 +71,19 @@ class Categories extends Table with TableInfo { } else if (isInserting) { context.missing(_nameMeta); } - if (data.containsKey('encryption_type')) { + if (data.containsKey('encrypt_type')) { context.handle( - _encryptionTypeMeta, - encryptionType.isAcceptableOrUnknown( - data['encryption_type']!, _encryptionTypeMeta)); + _encryptTypeMeta, + encryptType.isAcceptableOrUnknown( + data['encrypt_type']!, _encryptTypeMeta)); } else if (isInserting) { - context.missing(_encryptionTypeMeta); + context.missing(_encryptTypeMeta); } - if (data.containsKey('encryption_arguments')) { + if (data.containsKey('encrypt_arguments')) { context.handle( - _encryptionArgumentsMeta, - encryptionArguments.isAcceptableOrUnknown( - data['encryption_arguments']!, _encryptionArgumentsMeta)); + _encryptArgumentsMeta, + encryptArguments.isAcceptableOrUnknown( + data['encrypt_arguments']!, _encryptArgumentsMeta)); } if (data.containsKey('create_time')) { context.handle( @@ -120,10 +114,10 @@ class Categories extends Table with TableInfo { .read(DriftSqlType.int, data['${effectivePrefix}id'])!, name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name'])!, - encryptionType: attachedDatabase.typeMapping - .read(DriftSqlType.int, data['${effectivePrefix}encryption_type'])!, - encryptionArguments: attachedDatabase.typeMapping.read( - DriftSqlType.string, data['${effectivePrefix}encryption_arguments']), + encryptType: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}encrypt_type'])!, + encryptArguments: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}encrypt_arguments']), createTime: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}create_time'])!, lastUpdateTime: attachedDatabase.typeMapping.read( @@ -143,15 +137,15 @@ class Categories extends Table with TableInfo { class CategoryEntity extends DataClass implements Insertable { final int id; final String name; - final int encryptionType; - final String? encryptionArguments; + final int encryptType; + final String? encryptArguments; final String createTime; final String lastUpdateTime; const CategoryEntity( {required this.id, required this.name, - required this.encryptionType, - this.encryptionArguments, + required this.encryptType, + this.encryptArguments, required this.createTime, required this.lastUpdateTime}); @override @@ -159,9 +153,9 @@ class CategoryEntity extends DataClass implements Insertable { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); - map['encryption_type'] = Variable(encryptionType); - if (!nullToAbsent || encryptionArguments != null) { - map['encryption_arguments'] = Variable(encryptionArguments); + map['encrypt_type'] = Variable(encryptType); + if (!nullToAbsent || encryptArguments != null) { + map['encrypt_arguments'] = Variable(encryptArguments); } map['create_time'] = Variable(createTime); map['last_update_time'] = Variable(lastUpdateTime); @@ -172,10 +166,10 @@ class CategoryEntity extends DataClass implements Insertable { return CategoriesCompanion( id: Value(id), name: Value(name), - encryptionType: Value(encryptionType), - encryptionArguments: encryptionArguments == null && nullToAbsent + encryptType: Value(encryptType), + encryptArguments: encryptArguments == null && nullToAbsent ? const Value.absent() - : Value(encryptionArguments), + : Value(encryptArguments), createTime: Value(createTime), lastUpdateTime: Value(lastUpdateTime), ); @@ -187,9 +181,8 @@ class CategoryEntity extends DataClass implements Insertable { return CategoryEntity( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), - encryptionType: serializer.fromJson(json['encryption_type']), - encryptionArguments: - serializer.fromJson(json['encryption_arguments']), + encryptType: serializer.fromJson(json['encrypt_type']), + encryptArguments: serializer.fromJson(json['encrypt_arguments']), createTime: serializer.fromJson(json['create_time']), lastUpdateTime: serializer.fromJson(json['last_update_time']), ); @@ -200,8 +193,8 @@ class CategoryEntity extends DataClass implements Insertable { return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), - 'encryption_type': serializer.toJson(encryptionType), - 'encryption_arguments': serializer.toJson(encryptionArguments), + 'encrypt_type': serializer.toJson(encryptType), + 'encrypt_arguments': serializer.toJson(encryptArguments), 'create_time': serializer.toJson(createTime), 'last_update_time': serializer.toJson(lastUpdateTime), }; @@ -210,17 +203,17 @@ class CategoryEntity extends DataClass implements Insertable { CategoryEntity copyWith( {int? id, String? name, - int? encryptionType, - Value encryptionArguments = const Value.absent(), + int? encryptType, + Value encryptArguments = const Value.absent(), String? createTime, String? lastUpdateTime}) => CategoryEntity( id: id ?? this.id, name: name ?? this.name, - encryptionType: encryptionType ?? this.encryptionType, - encryptionArguments: encryptionArguments.present - ? encryptionArguments.value - : this.encryptionArguments, + encryptType: encryptType ?? this.encryptType, + encryptArguments: encryptArguments.present + ? encryptArguments.value + : this.encryptArguments, createTime: createTime ?? this.createTime, lastUpdateTime: lastUpdateTime ?? this.lastUpdateTime, ); @@ -229,8 +222,8 @@ class CategoryEntity extends DataClass implements Insertable { return (StringBuffer('CategoryEntity(') ..write('id: $id, ') ..write('name: $name, ') - ..write('encryptionType: $encryptionType, ') - ..write('encryptionArguments: $encryptionArguments, ') + ..write('encryptType: $encryptType, ') + ..write('encryptArguments: $encryptArguments, ') ..write('createTime: $createTime, ') ..write('lastUpdateTime: $lastUpdateTime') ..write(')')) @@ -238,16 +231,16 @@ class CategoryEntity extends DataClass implements Insertable { } @override - int get hashCode => Object.hash(id, name, encryptionType, encryptionArguments, - createTime, lastUpdateTime); + int get hashCode => Object.hash( + id, name, encryptType, encryptArguments, createTime, lastUpdateTime); @override bool operator ==(Object other) => identical(this, other) || (other is CategoryEntity && other.id == this.id && other.name == this.name && - other.encryptionType == this.encryptionType && - other.encryptionArguments == this.encryptionArguments && + other.encryptType == this.encryptType && + other.encryptArguments == this.encryptArguments && other.createTime == this.createTime && other.lastUpdateTime == this.lastUpdateTime); } @@ -255,43 +248,42 @@ class CategoryEntity extends DataClass implements Insertable { class CategoriesCompanion extends UpdateCompanion { final Value id; final Value name; - final Value encryptionType; - final Value encryptionArguments; + final Value encryptType; + final Value encryptArguments; final Value createTime; final Value lastUpdateTime; const CategoriesCompanion({ this.id = const Value.absent(), this.name = const Value.absent(), - this.encryptionType = const Value.absent(), - this.encryptionArguments = const Value.absent(), + this.encryptType = const Value.absent(), + this.encryptArguments = const Value.absent(), this.createTime = const Value.absent(), this.lastUpdateTime = const Value.absent(), }); CategoriesCompanion.insert({ this.id = const Value.absent(), required String name, - required int encryptionType, - this.encryptionArguments = const Value.absent(), + required int encryptType, + this.encryptArguments = const Value.absent(), required String createTime, required String lastUpdateTime, }) : name = Value(name), - encryptionType = Value(encryptionType), + encryptType = Value(encryptType), createTime = Value(createTime), lastUpdateTime = Value(lastUpdateTime); static Insertable custom({ Expression? id, Expression? name, - Expression? encryptionType, - Expression? encryptionArguments, + Expression? encryptType, + Expression? encryptArguments, Expression? createTime, Expression? lastUpdateTime, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (name != null) 'name': name, - if (encryptionType != null) 'encryption_type': encryptionType, - if (encryptionArguments != null) - 'encryption_arguments': encryptionArguments, + if (encryptType != null) 'encrypt_type': encryptType, + if (encryptArguments != null) 'encrypt_arguments': encryptArguments, if (createTime != null) 'create_time': createTime, if (lastUpdateTime != null) 'last_update_time': lastUpdateTime, }); @@ -300,15 +292,15 @@ class CategoriesCompanion extends UpdateCompanion { CategoriesCompanion copyWith( {Value? id, Value? name, - Value? encryptionType, - Value? encryptionArguments, + Value? encryptType, + Value? encryptArguments, Value? createTime, Value? lastUpdateTime}) { return CategoriesCompanion( id: id ?? this.id, name: name ?? this.name, - encryptionType: encryptionType ?? this.encryptionType, - encryptionArguments: encryptionArguments ?? this.encryptionArguments, + encryptType: encryptType ?? this.encryptType, + encryptArguments: encryptArguments ?? this.encryptArguments, createTime: createTime ?? this.createTime, lastUpdateTime: lastUpdateTime ?? this.lastUpdateTime, ); @@ -323,11 +315,11 @@ class CategoriesCompanion extends UpdateCompanion { if (name.present) { map['name'] = Variable(name.value); } - if (encryptionType.present) { - map['encryption_type'] = Variable(encryptionType.value); + if (encryptType.present) { + map['encrypt_type'] = Variable(encryptType.value); } - if (encryptionArguments.present) { - map['encryption_arguments'] = Variable(encryptionArguments.value); + if (encryptArguments.present) { + map['encrypt_arguments'] = Variable(encryptArguments.value); } if (createTime.present) { map['create_time'] = Variable(createTime.value); @@ -343,8 +335,8 @@ class CategoriesCompanion extends UpdateCompanion { return (StringBuffer('CategoriesCompanion(') ..write('id: $id, ') ..write('name: $name, ') - ..write('encryptionType: $encryptionType, ') - ..write('encryptionArguments: $encryptionArguments, ') + ..write('encryptType: $encryptType, ') + ..write('encryptArguments: $encryptArguments, ') ..write('createTime: $createTime, ') ..write('lastUpdateTime: $lastUpdateTime') ..write(')')) @@ -422,20 +414,20 @@ class Notes extends Table with TableInfo { type: DriftSqlType.string, requiredDuringInsert: false, $customConstraints: ''); - static const VerificationMeta _encryptionTypeMeta = - const VerificationMeta('encryptionType'); - late final GeneratedColumn encryptionType = GeneratedColumn( - 'encryption_type', aliasedName, false, + static const VerificationMeta _encryptTypeMeta = + const VerificationMeta('encryptType'); + late final GeneratedColumn encryptType = GeneratedColumn( + 'encrypt_type', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); - static const VerificationMeta _encryptionArgumentsMeta = - const VerificationMeta('encryptionArguments'); - late final GeneratedColumn encryptionArguments = - GeneratedColumn('encryption_arguments', aliasedName, true, - type: DriftSqlType.string, - requiredDuringInsert: false, - $customConstraints: ''); + static const VerificationMeta _encryptArgumentsMeta = + const VerificationMeta('encryptArguments'); + late final GeneratedColumn encryptArguments = GeneratedColumn( + 'encrypt_arguments', aliasedName, true, + type: DriftSqlType.string, + requiredDuringInsert: false, + $customConstraints: ''); static const VerificationMeta _createTimeMeta = const VerificationMeta('createTime'); late final GeneratedColumn createTime = GeneratedColumn( @@ -469,8 +461,8 @@ class Notes extends Table with TableInfo { location, weather, mood, - encryptionType, - encryptionArguments, + encryptType, + encryptArguments, createTime, lastUpdateTime, categoryId @@ -532,19 +524,19 @@ class Notes extends Table with TableInfo { context.handle( _moodMeta, mood.isAcceptableOrUnknown(data['mood']!, _moodMeta)); } - if (data.containsKey('encryption_type')) { + if (data.containsKey('encrypt_type')) { context.handle( - _encryptionTypeMeta, - encryptionType.isAcceptableOrUnknown( - data['encryption_type']!, _encryptionTypeMeta)); + _encryptTypeMeta, + encryptType.isAcceptableOrUnknown( + data['encrypt_type']!, _encryptTypeMeta)); } else if (isInserting) { - context.missing(_encryptionTypeMeta); + context.missing(_encryptTypeMeta); } - if (data.containsKey('encryption_arguments')) { + if (data.containsKey('encrypt_arguments')) { context.handle( - _encryptionArgumentsMeta, - encryptionArguments.isAcceptableOrUnknown( - data['encryption_arguments']!, _encryptionArgumentsMeta)); + _encryptArgumentsMeta, + encryptArguments.isAcceptableOrUnknown( + data['encrypt_arguments']!, _encryptArgumentsMeta)); } if (data.containsKey('create_time')) { context.handle( @@ -597,10 +589,10 @@ class Notes extends Table with TableInfo { .read(DriftSqlType.string, data['${effectivePrefix}weather']), mood: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}mood']), - encryptionType: attachedDatabase.typeMapping - .read(DriftSqlType.int, data['${effectivePrefix}encryption_type'])!, - encryptionArguments: attachedDatabase.typeMapping.read( - DriftSqlType.string, data['${effectivePrefix}encryption_arguments']), + encryptType: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}encrypt_type'])!, + encryptArguments: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}encrypt_arguments']), createTime: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}create_time'])!, lastUpdateTime: attachedDatabase.typeMapping.read( @@ -633,8 +625,8 @@ class NoteEntity extends DataClass implements Insertable { final String? location; final String? weather; final String? mood; - final int encryptionType; - final String? encryptionArguments; + final int encryptType; + final String? encryptArguments; final String createTime; final String lastUpdateTime; final int? categoryId; @@ -649,8 +641,8 @@ class NoteEntity extends DataClass implements Insertable { this.location, this.weather, this.mood, - required this.encryptionType, - this.encryptionArguments, + required this.encryptType, + this.encryptArguments, required this.createTime, required this.lastUpdateTime, this.categoryId}); @@ -677,9 +669,9 @@ class NoteEntity extends DataClass implements Insertable { if (!nullToAbsent || mood != null) { map['mood'] = Variable(mood); } - map['encryption_type'] = Variable(encryptionType); - if (!nullToAbsent || encryptionArguments != null) { - map['encryption_arguments'] = Variable(encryptionArguments); + map['encrypt_type'] = Variable(encryptType); + if (!nullToAbsent || encryptArguments != null) { + map['encrypt_arguments'] = Variable(encryptArguments); } map['create_time'] = Variable(createTime); map['last_update_time'] = Variable(lastUpdateTime); @@ -707,10 +699,10 @@ class NoteEntity extends DataClass implements Insertable { ? const Value.absent() : Value(weather), mood: mood == null && nullToAbsent ? const Value.absent() : Value(mood), - encryptionType: Value(encryptionType), - encryptionArguments: encryptionArguments == null && nullToAbsent + encryptType: Value(encryptType), + encryptArguments: encryptArguments == null && nullToAbsent ? const Value.absent() - : Value(encryptionArguments), + : Value(encryptArguments), createTime: Value(createTime), lastUpdateTime: Value(lastUpdateTime), categoryId: categoryId == null && nullToAbsent @@ -733,9 +725,8 @@ class NoteEntity extends DataClass implements Insertable { location: serializer.fromJson(json['location']), weather: serializer.fromJson(json['weather']), mood: serializer.fromJson(json['mood']), - encryptionType: serializer.fromJson(json['encryption_type']), - encryptionArguments: - serializer.fromJson(json['encryption_arguments']), + encryptType: serializer.fromJson(json['encrypt_type']), + encryptArguments: serializer.fromJson(json['encrypt_arguments']), createTime: serializer.fromJson(json['create_time']), lastUpdateTime: serializer.fromJson(json['last_update_time']), categoryId: serializer.fromJson(json['category_id']), @@ -755,8 +746,8 @@ class NoteEntity extends DataClass implements Insertable { 'location': serializer.toJson(location), 'weather': serializer.toJson(weather), 'mood': serializer.toJson(mood), - 'encryption_type': serializer.toJson(encryptionType), - 'encryption_arguments': serializer.toJson(encryptionArguments), + 'encrypt_type': serializer.toJson(encryptType), + 'encrypt_arguments': serializer.toJson(encryptArguments), 'create_time': serializer.toJson(createTime), 'last_update_time': serializer.toJson(lastUpdateTime), 'category_id': serializer.toJson(categoryId), @@ -774,8 +765,8 @@ class NoteEntity extends DataClass implements Insertable { Value location = const Value.absent(), Value weather = const Value.absent(), Value mood = const Value.absent(), - int? encryptionType, - Value encryptionArguments = const Value.absent(), + int? encryptType, + Value encryptArguments = const Value.absent(), String? createTime, String? lastUpdateTime, Value categoryId = const Value.absent()}) => @@ -790,10 +781,10 @@ class NoteEntity extends DataClass implements Insertable { location: location.present ? location.value : this.location, weather: weather.present ? weather.value : this.weather, mood: mood.present ? mood.value : this.mood, - encryptionType: encryptionType ?? this.encryptionType, - encryptionArguments: encryptionArguments.present - ? encryptionArguments.value - : this.encryptionArguments, + encryptType: encryptType ?? this.encryptType, + encryptArguments: encryptArguments.present + ? encryptArguments.value + : this.encryptArguments, createTime: createTime ?? this.createTime, lastUpdateTime: lastUpdateTime ?? this.lastUpdateTime, categoryId: categoryId.present ? categoryId.value : this.categoryId, @@ -811,8 +802,8 @@ class NoteEntity extends DataClass implements Insertable { ..write('location: $location, ') ..write('weather: $weather, ') ..write('mood: $mood, ') - ..write('encryptionType: $encryptionType, ') - ..write('encryptionArguments: $encryptionArguments, ') + ..write('encryptType: $encryptType, ') + ..write('encryptArguments: $encryptArguments, ') ..write('createTime: $createTime, ') ..write('lastUpdateTime: $lastUpdateTime, ') ..write('categoryId: $categoryId') @@ -832,8 +823,8 @@ class NoteEntity extends DataClass implements Insertable { location, weather, mood, - encryptionType, - encryptionArguments, + encryptType, + encryptArguments, createTime, lastUpdateTime, categoryId); @@ -851,8 +842,8 @@ class NoteEntity extends DataClass implements Insertable { other.location == this.location && other.weather == this.weather && other.mood == this.mood && - other.encryptionType == this.encryptionType && - other.encryptionArguments == this.encryptionArguments && + other.encryptType == this.encryptType && + other.encryptArguments == this.encryptArguments && other.createTime == this.createTime && other.lastUpdateTime == this.lastUpdateTime && other.categoryId == this.categoryId); @@ -869,8 +860,8 @@ class NotesCompanion extends UpdateCompanion { final Value location; final Value weather; final Value mood; - final Value encryptionType; - final Value encryptionArguments; + final Value encryptType; + final Value encryptArguments; final Value createTime; final Value lastUpdateTime; final Value categoryId; @@ -885,8 +876,8 @@ class NotesCompanion extends UpdateCompanion { this.location = const Value.absent(), this.weather = const Value.absent(), this.mood = const Value.absent(), - this.encryptionType = const Value.absent(), - this.encryptionArguments = const Value.absent(), + this.encryptType = const Value.absent(), + this.encryptArguments = const Value.absent(), this.createTime = const Value.absent(), this.lastUpdateTime = const Value.absent(), this.categoryId = const Value.absent(), @@ -902,8 +893,8 @@ class NotesCompanion extends UpdateCompanion { this.location = const Value.absent(), this.weather = const Value.absent(), this.mood = const Value.absent(), - required int encryptionType, - this.encryptionArguments = const Value.absent(), + required int encryptType, + this.encryptArguments = const Value.absent(), required String createTime, required String lastUpdateTime, this.categoryId = const Value.absent(), @@ -911,7 +902,7 @@ class NotesCompanion extends UpdateCompanion { format = Value(format), title = Value(title), content = Value(content), - encryptionType = Value(encryptionType), + encryptType = Value(encryptType), createTime = Value(createTime), lastUpdateTime = Value(lastUpdateTime); static Insertable custom({ @@ -925,8 +916,8 @@ class NotesCompanion extends UpdateCompanion { Expression? location, Expression? weather, Expression? mood, - Expression? encryptionType, - Expression? encryptionArguments, + Expression? encryptType, + Expression? encryptArguments, Expression? createTime, Expression? lastUpdateTime, Expression? categoryId, @@ -942,9 +933,8 @@ class NotesCompanion extends UpdateCompanion { if (location != null) 'location': location, if (weather != null) 'weather': weather, if (mood != null) 'mood': mood, - if (encryptionType != null) 'encryption_type': encryptionType, - if (encryptionArguments != null) - 'encryption_arguments': encryptionArguments, + if (encryptType != null) 'encrypt_type': encryptType, + if (encryptArguments != null) 'encrypt_arguments': encryptArguments, if (createTime != null) 'create_time': createTime, if (lastUpdateTime != null) 'last_update_time': lastUpdateTime, if (categoryId != null) 'category_id': categoryId, @@ -962,8 +952,8 @@ class NotesCompanion extends UpdateCompanion { Value? location, Value? weather, Value? mood, - Value? encryptionType, - Value? encryptionArguments, + Value? encryptType, + Value? encryptArguments, Value? createTime, Value? lastUpdateTime, Value? categoryId}) { @@ -978,8 +968,8 @@ class NotesCompanion extends UpdateCompanion { location: location ?? this.location, weather: weather ?? this.weather, mood: mood ?? this.mood, - encryptionType: encryptionType ?? this.encryptionType, - encryptionArguments: encryptionArguments ?? this.encryptionArguments, + encryptType: encryptType ?? this.encryptType, + encryptArguments: encryptArguments ?? this.encryptArguments, createTime: createTime ?? this.createTime, lastUpdateTime: lastUpdateTime ?? this.lastUpdateTime, categoryId: categoryId ?? this.categoryId, @@ -1019,11 +1009,11 @@ class NotesCompanion extends UpdateCompanion { if (mood.present) { map['mood'] = Variable(mood.value); } - if (encryptionType.present) { - map['encryption_type'] = Variable(encryptionType.value); + if (encryptType.present) { + map['encrypt_type'] = Variable(encryptType.value); } - if (encryptionArguments.present) { - map['encryption_arguments'] = Variable(encryptionArguments.value); + if (encryptArguments.present) { + map['encrypt_arguments'] = Variable(encryptArguments.value); } if (createTime.present) { map['create_time'] = Variable(createTime.value); @@ -1050,8 +1040,8 @@ class NotesCompanion extends UpdateCompanion { ..write('location: $location, ') ..write('weather: $weather, ') ..write('mood: $mood, ') - ..write('encryptionType: $encryptionType, ') - ..write('encryptionArguments: $encryptionArguments, ') + ..write('encryptType: $encryptType, ') + ..write('encryptArguments: $encryptArguments, ') ..write('createTime: $createTime, ') ..write('lastUpdateTime: $lastUpdateTime, ') ..write('categoryId: $categoryId') @@ -1110,20 +1100,20 @@ class Files extends Table with TableInfo { type: DriftSqlType.string, requiredDuringInsert: false, $customConstraints: ''); - static const VerificationMeta _encryptionTypeMeta = - const VerificationMeta('encryptionType'); - late final GeneratedColumn encryptionType = GeneratedColumn( - 'encryption_type', aliasedName, false, + static const VerificationMeta _encryptTypeMeta = + const VerificationMeta('encryptType'); + late final GeneratedColumn encryptType = GeneratedColumn( + 'encrypt_type', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); - static const VerificationMeta _encryptionArgumentsMeta = - const VerificationMeta('encryptionArguments'); - late final GeneratedColumn encryptionArguments = - GeneratedColumn('encryption_arguments', aliasedName, true, - type: DriftSqlType.string, - requiredDuringInsert: false, - $customConstraints: ''); + static const VerificationMeta _encryptArgumentsMeta = + const VerificationMeta('encryptArguments'); + late final GeneratedColumn encryptArguments = GeneratedColumn( + 'encrypt_arguments', aliasedName, true, + type: DriftSqlType.string, + requiredDuringInsert: false, + $customConstraints: ''); static const VerificationMeta _remarkMeta = const VerificationMeta('remark'); late final GeneratedColumn remark = GeneratedColumn( 'remark', aliasedName, true, @@ -1160,8 +1150,8 @@ class Files extends Table with TableInfo { thumbnailPath, format, checksum, - encryptionType, - encryptionArguments, + encryptType, + encryptArguments, remark, categoryId, createTime, @@ -1214,19 +1204,19 @@ class Files extends Table with TableInfo { context.handle(_checksumMeta, checksum.isAcceptableOrUnknown(data['checksum']!, _checksumMeta)); } - if (data.containsKey('encryption_type')) { + if (data.containsKey('encrypt_type')) { context.handle( - _encryptionTypeMeta, - encryptionType.isAcceptableOrUnknown( - data['encryption_type']!, _encryptionTypeMeta)); + _encryptTypeMeta, + encryptType.isAcceptableOrUnknown( + data['encrypt_type']!, _encryptTypeMeta)); } else if (isInserting) { - context.missing(_encryptionTypeMeta); + context.missing(_encryptTypeMeta); } - if (data.containsKey('encryption_arguments')) { + if (data.containsKey('encrypt_arguments')) { context.handle( - _encryptionArgumentsMeta, - encryptionArguments.isAcceptableOrUnknown( - data['encryption_arguments']!, _encryptionArgumentsMeta)); + _encryptArgumentsMeta, + encryptArguments.isAcceptableOrUnknown( + data['encrypt_arguments']!, _encryptArgumentsMeta)); } if (data.containsKey('remark')) { context.handle(_remarkMeta, @@ -1277,10 +1267,10 @@ class Files extends Table with TableInfo { .read(DriftSqlType.string, data['${effectivePrefix}format'])!, checksum: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}checksum']), - encryptionType: attachedDatabase.typeMapping - .read(DriftSqlType.int, data['${effectivePrefix}encryption_type'])!, - encryptionArguments: attachedDatabase.typeMapping.read( - DriftSqlType.string, data['${effectivePrefix}encryption_arguments']), + encryptType: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}encrypt_type'])!, + encryptArguments: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}encrypt_arguments']), remark: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}remark']), categoryId: attachedDatabase.typeMapping @@ -1312,8 +1302,8 @@ class FileEntity extends DataClass implements Insertable { final String? thumbnailPath; final String format; final String? checksum; - final int encryptionType; - final String? encryptionArguments; + final int encryptType; + final String? encryptArguments; final String? remark; final int? categoryId; final String createTime; @@ -1326,8 +1316,8 @@ class FileEntity extends DataClass implements Insertable { this.thumbnailPath, required this.format, this.checksum, - required this.encryptionType, - this.encryptionArguments, + required this.encryptType, + this.encryptArguments, this.remark, this.categoryId, required this.createTime, @@ -1346,9 +1336,9 @@ class FileEntity extends DataClass implements Insertable { if (!nullToAbsent || checksum != null) { map['checksum'] = Variable(checksum); } - map['encryption_type'] = Variable(encryptionType); - if (!nullToAbsent || encryptionArguments != null) { - map['encryption_arguments'] = Variable(encryptionArguments); + map['encrypt_type'] = Variable(encryptType); + if (!nullToAbsent || encryptArguments != null) { + map['encrypt_arguments'] = Variable(encryptArguments); } if (!nullToAbsent || remark != null) { map['remark'] = Variable(remark); @@ -1374,10 +1364,10 @@ class FileEntity extends DataClass implements Insertable { checksum: checksum == null && nullToAbsent ? const Value.absent() : Value(checksum), - encryptionType: Value(encryptionType), - encryptionArguments: encryptionArguments == null && nullToAbsent + encryptType: Value(encryptType), + encryptArguments: encryptArguments == null && nullToAbsent ? const Value.absent() - : Value(encryptionArguments), + : Value(encryptArguments), remark: remark == null && nullToAbsent ? const Value.absent() : Value(remark), categoryId: categoryId == null && nullToAbsent @@ -1399,9 +1389,8 @@ class FileEntity extends DataClass implements Insertable { thumbnailPath: serializer.fromJson(json['thumbnail_path']), format: serializer.fromJson(json['format']), checksum: serializer.fromJson(json['checksum']), - encryptionType: serializer.fromJson(json['encryption_type']), - encryptionArguments: - serializer.fromJson(json['encryption_arguments']), + encryptType: serializer.fromJson(json['encrypt_type']), + encryptArguments: serializer.fromJson(json['encrypt_arguments']), remark: serializer.fromJson(json['remark']), categoryId: serializer.fromJson(json['category_id']), createTime: serializer.fromJson(json['create_time']), @@ -1419,8 +1408,8 @@ class FileEntity extends DataClass implements Insertable { 'thumbnail_path': serializer.toJson(thumbnailPath), 'format': serializer.toJson(format), 'checksum': serializer.toJson(checksum), - 'encryption_type': serializer.toJson(encryptionType), - 'encryption_arguments': serializer.toJson(encryptionArguments), + 'encrypt_type': serializer.toJson(encryptType), + 'encrypt_arguments': serializer.toJson(encryptArguments), 'remark': serializer.toJson(remark), 'category_id': serializer.toJson(categoryId), 'create_time': serializer.toJson(createTime), @@ -1436,8 +1425,8 @@ class FileEntity extends DataClass implements Insertable { Value thumbnailPath = const Value.absent(), String? format, Value checksum = const Value.absent(), - int? encryptionType, - Value encryptionArguments = const Value.absent(), + int? encryptType, + Value encryptArguments = const Value.absent(), Value remark = const Value.absent(), Value categoryId = const Value.absent(), String? createTime, @@ -1451,10 +1440,10 @@ class FileEntity extends DataClass implements Insertable { thumbnailPath.present ? thumbnailPath.value : this.thumbnailPath, format: format ?? this.format, checksum: checksum.present ? checksum.value : this.checksum, - encryptionType: encryptionType ?? this.encryptionType, - encryptionArguments: encryptionArguments.present - ? encryptionArguments.value - : this.encryptionArguments, + encryptType: encryptType ?? this.encryptType, + encryptArguments: encryptArguments.present + ? encryptArguments.value + : this.encryptArguments, remark: remark.present ? remark.value : this.remark, categoryId: categoryId.present ? categoryId.value : this.categoryId, createTime: createTime ?? this.createTime, @@ -1470,8 +1459,8 @@ class FileEntity extends DataClass implements Insertable { ..write('thumbnailPath: $thumbnailPath, ') ..write('format: $format, ') ..write('checksum: $checksum, ') - ..write('encryptionType: $encryptionType, ') - ..write('encryptionArguments: $encryptionArguments, ') + ..write('encryptType: $encryptType, ') + ..write('encryptArguments: $encryptArguments, ') ..write('remark: $remark, ') ..write('categoryId: $categoryId, ') ..write('createTime: $createTime, ') @@ -1489,8 +1478,8 @@ class FileEntity extends DataClass implements Insertable { thumbnailPath, format, checksum, - encryptionType, - encryptionArguments, + encryptType, + encryptArguments, remark, categoryId, createTime, @@ -1506,8 +1495,8 @@ class FileEntity extends DataClass implements Insertable { other.thumbnailPath == this.thumbnailPath && other.format == this.format && other.checksum == this.checksum && - other.encryptionType == this.encryptionType && - other.encryptionArguments == this.encryptionArguments && + other.encryptType == this.encryptType && + other.encryptArguments == this.encryptArguments && other.remark == this.remark && other.categoryId == this.categoryId && other.createTime == this.createTime && @@ -1522,8 +1511,8 @@ class FilesCompanion extends UpdateCompanion { final Value thumbnailPath; final Value format; final Value checksum; - final Value encryptionType; - final Value encryptionArguments; + final Value encryptType; + final Value encryptArguments; final Value remark; final Value categoryId; final Value createTime; @@ -1536,8 +1525,8 @@ class FilesCompanion extends UpdateCompanion { this.thumbnailPath = const Value.absent(), this.format = const Value.absent(), this.checksum = const Value.absent(), - this.encryptionType = const Value.absent(), - this.encryptionArguments = const Value.absent(), + this.encryptType = const Value.absent(), + this.encryptArguments = const Value.absent(), this.remark = const Value.absent(), this.categoryId = const Value.absent(), this.createTime = const Value.absent(), @@ -1551,8 +1540,8 @@ class FilesCompanion extends UpdateCompanion { this.thumbnailPath = const Value.absent(), required String format, this.checksum = const Value.absent(), - required int encryptionType, - this.encryptionArguments = const Value.absent(), + required int encryptType, + this.encryptArguments = const Value.absent(), this.remark = const Value.absent(), this.categoryId = const Value.absent(), required String createTime, @@ -1561,7 +1550,7 @@ class FilesCompanion extends UpdateCompanion { name = Value(name), path = Value(path), format = Value(format), - encryptionType = Value(encryptionType), + encryptType = Value(encryptType), createTime = Value(createTime), lastUpdateTime = Value(lastUpdateTime); static Insertable custom({ @@ -1572,8 +1561,8 @@ class FilesCompanion extends UpdateCompanion { Expression? thumbnailPath, Expression? format, Expression? checksum, - Expression? encryptionType, - Expression? encryptionArguments, + Expression? encryptType, + Expression? encryptArguments, Expression? remark, Expression? categoryId, Expression? createTime, @@ -1587,9 +1576,8 @@ class FilesCompanion extends UpdateCompanion { if (thumbnailPath != null) 'thumbnail_path': thumbnailPath, if (format != null) 'format': format, if (checksum != null) 'checksum': checksum, - if (encryptionType != null) 'encryption_type': encryptionType, - if (encryptionArguments != null) - 'encryption_arguments': encryptionArguments, + if (encryptType != null) 'encrypt_type': encryptType, + if (encryptArguments != null) 'encrypt_arguments': encryptArguments, if (remark != null) 'remark': remark, if (categoryId != null) 'category_id': categoryId, if (createTime != null) 'create_time': createTime, @@ -1605,8 +1593,8 @@ class FilesCompanion extends UpdateCompanion { Value? thumbnailPath, Value? format, Value? checksum, - Value? encryptionType, - Value? encryptionArguments, + Value? encryptType, + Value? encryptArguments, Value? remark, Value? categoryId, Value? createTime, @@ -1619,8 +1607,8 @@ class FilesCompanion extends UpdateCompanion { thumbnailPath: thumbnailPath ?? this.thumbnailPath, format: format ?? this.format, checksum: checksum ?? this.checksum, - encryptionType: encryptionType ?? this.encryptionType, - encryptionArguments: encryptionArguments ?? this.encryptionArguments, + encryptType: encryptType ?? this.encryptType, + encryptArguments: encryptArguments ?? this.encryptArguments, remark: remark ?? this.remark, categoryId: categoryId ?? this.categoryId, createTime: createTime ?? this.createTime, @@ -1652,11 +1640,11 @@ class FilesCompanion extends UpdateCompanion { if (checksum.present) { map['checksum'] = Variable(checksum.value); } - if (encryptionType.present) { - map['encryption_type'] = Variable(encryptionType.value); + if (encryptType.present) { + map['encrypt_type'] = Variable(encryptType.value); } - if (encryptionArguments.present) { - map['encryption_arguments'] = Variable(encryptionArguments.value); + if (encryptArguments.present) { + map['encrypt_arguments'] = Variable(encryptArguments.value); } if (remark.present) { map['remark'] = Variable(remark.value); @@ -1683,8 +1671,8 @@ class FilesCompanion extends UpdateCompanion { ..write('thumbnailPath: $thumbnailPath, ') ..write('format: $format, ') ..write('checksum: $checksum, ') - ..write('encryptionType: $encryptionType, ') - ..write('encryptionArguments: $encryptionArguments, ') + ..write('encryptType: $encryptType, ') + ..write('encryptArguments: $encryptArguments, ') ..write('remark: $remark, ') ..write('categoryId: $categoryId, ') ..write('createTime: $createTime, ') @@ -2661,20 +2649,20 @@ class Passwords extends Table with TableInfo { type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); - static const VerificationMeta _encryptionTypeMeta = - const VerificationMeta('encryptionType'); - late final GeneratedColumn encryptionType = GeneratedColumn( - 'encryption_type', aliasedName, false, + static const VerificationMeta _encryptTypeMeta = + const VerificationMeta('encryptType'); + late final GeneratedColumn encryptType = GeneratedColumn( + 'encrypt_type', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); - static const VerificationMeta _encryptionArgumentsMeta = - const VerificationMeta('encryptionArguments'); - late final GeneratedColumn encryptionArguments = - GeneratedColumn('encryption_arguments', aliasedName, true, - type: DriftSqlType.string, - requiredDuringInsert: false, - $customConstraints: ''); + static const VerificationMeta _encryptArgumentsMeta = + const VerificationMeta('encryptArguments'); + late final GeneratedColumn encryptArguments = GeneratedColumn( + 'encrypt_arguments', aliasedName, true, + type: DriftSqlType.string, + requiredDuringInsert: false, + $customConstraints: ''); static const VerificationMeta _remarkMeta = const VerificationMeta('remark'); late final GeneratedColumn remark = GeneratedColumn( 'remark', aliasedName, true, @@ -2700,8 +2688,8 @@ class Passwords extends Table with TableInfo { id, title, password, - encryptionType, - encryptionArguments, + encryptType, + encryptArguments, remark, createTime, lastUpdateTime @@ -2731,19 +2719,19 @@ class Passwords extends Table with TableInfo { } else if (isInserting) { context.missing(_passwordMeta); } - if (data.containsKey('encryption_type')) { + if (data.containsKey('encrypt_type')) { context.handle( - _encryptionTypeMeta, - encryptionType.isAcceptableOrUnknown( - data['encryption_type']!, _encryptionTypeMeta)); + _encryptTypeMeta, + encryptType.isAcceptableOrUnknown( + data['encrypt_type']!, _encryptTypeMeta)); } else if (isInserting) { - context.missing(_encryptionTypeMeta); + context.missing(_encryptTypeMeta); } - if (data.containsKey('encryption_arguments')) { + if (data.containsKey('encrypt_arguments')) { context.handle( - _encryptionArgumentsMeta, - encryptionArguments.isAcceptableOrUnknown( - data['encryption_arguments']!, _encryptionArgumentsMeta)); + _encryptArgumentsMeta, + encryptArguments.isAcceptableOrUnknown( + data['encrypt_arguments']!, _encryptArgumentsMeta)); } if (data.containsKey('remark')) { context.handle(_remarkMeta, @@ -2780,10 +2768,10 @@ class Passwords extends Table with TableInfo { .read(DriftSqlType.string, data['${effectivePrefix}title'])!, password: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}password'])!, - encryptionType: attachedDatabase.typeMapping - .read(DriftSqlType.int, data['${effectivePrefix}encryption_type'])!, - encryptionArguments: attachedDatabase.typeMapping.read( - DriftSqlType.string, data['${effectivePrefix}encryption_arguments']), + encryptType: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}encrypt_type'])!, + encryptArguments: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}encrypt_arguments']), remark: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}remark']), createTime: attachedDatabase.typeMapping @@ -2806,8 +2794,8 @@ class PasswordEntity extends DataClass implements Insertable { final int id; final String title; final String password; - final int encryptionType; - final String? encryptionArguments; + final int encryptType; + final String? encryptArguments; final String? remark; final String createTime; final String lastUpdateTime; @@ -2815,8 +2803,8 @@ class PasswordEntity extends DataClass implements Insertable { {required this.id, required this.title, required this.password, - required this.encryptionType, - this.encryptionArguments, + required this.encryptType, + this.encryptArguments, this.remark, required this.createTime, required this.lastUpdateTime}); @@ -2826,9 +2814,9 @@ class PasswordEntity extends DataClass implements Insertable { map['id'] = Variable(id); map['title'] = Variable(title); map['password'] = Variable(password); - map['encryption_type'] = Variable(encryptionType); - if (!nullToAbsent || encryptionArguments != null) { - map['encryption_arguments'] = Variable(encryptionArguments); + map['encrypt_type'] = Variable(encryptType); + if (!nullToAbsent || encryptArguments != null) { + map['encrypt_arguments'] = Variable(encryptArguments); } if (!nullToAbsent || remark != null) { map['remark'] = Variable(remark); @@ -2843,10 +2831,10 @@ class PasswordEntity extends DataClass implements Insertable { id: Value(id), title: Value(title), password: Value(password), - encryptionType: Value(encryptionType), - encryptionArguments: encryptionArguments == null && nullToAbsent + encryptType: Value(encryptType), + encryptArguments: encryptArguments == null && nullToAbsent ? const Value.absent() - : Value(encryptionArguments), + : Value(encryptArguments), remark: remark == null && nullToAbsent ? const Value.absent() : Value(remark), createTime: Value(createTime), @@ -2861,9 +2849,8 @@ class PasswordEntity extends DataClass implements Insertable { id: serializer.fromJson(json['id']), title: serializer.fromJson(json['title']), password: serializer.fromJson(json['password']), - encryptionType: serializer.fromJson(json['encryption_type']), - encryptionArguments: - serializer.fromJson(json['encryption_arguments']), + encryptType: serializer.fromJson(json['encrypt_type']), + encryptArguments: serializer.fromJson(json['encrypt_arguments']), remark: serializer.fromJson(json['remark']), createTime: serializer.fromJson(json['create_time']), lastUpdateTime: serializer.fromJson(json['last_update_time']), @@ -2876,8 +2863,8 @@ class PasswordEntity extends DataClass implements Insertable { 'id': serializer.toJson(id), 'title': serializer.toJson(title), 'password': serializer.toJson(password), - 'encryption_type': serializer.toJson(encryptionType), - 'encryption_arguments': serializer.toJson(encryptionArguments), + 'encrypt_type': serializer.toJson(encryptType), + 'encrypt_arguments': serializer.toJson(encryptArguments), 'remark': serializer.toJson(remark), 'create_time': serializer.toJson(createTime), 'last_update_time': serializer.toJson(lastUpdateTime), @@ -2888,8 +2875,8 @@ class PasswordEntity extends DataClass implements Insertable { {int? id, String? title, String? password, - int? encryptionType, - Value encryptionArguments = const Value.absent(), + int? encryptType, + Value encryptArguments = const Value.absent(), Value remark = const Value.absent(), String? createTime, String? lastUpdateTime}) => @@ -2897,10 +2884,10 @@ class PasswordEntity extends DataClass implements Insertable { id: id ?? this.id, title: title ?? this.title, password: password ?? this.password, - encryptionType: encryptionType ?? this.encryptionType, - encryptionArguments: encryptionArguments.present - ? encryptionArguments.value - : this.encryptionArguments, + encryptType: encryptType ?? this.encryptType, + encryptArguments: encryptArguments.present + ? encryptArguments.value + : this.encryptArguments, remark: remark.present ? remark.value : this.remark, createTime: createTime ?? this.createTime, lastUpdateTime: lastUpdateTime ?? this.lastUpdateTime, @@ -2911,8 +2898,8 @@ class PasswordEntity extends DataClass implements Insertable { ..write('id: $id, ') ..write('title: $title, ') ..write('password: $password, ') - ..write('encryptionType: $encryptionType, ') - ..write('encryptionArguments: $encryptionArguments, ') + ..write('encryptType: $encryptType, ') + ..write('encryptArguments: $encryptArguments, ') ..write('remark: $remark, ') ..write('createTime: $createTime, ') ..write('lastUpdateTime: $lastUpdateTime') @@ -2921,8 +2908,8 @@ class PasswordEntity extends DataClass implements Insertable { } @override - int get hashCode => Object.hash(id, title, password, encryptionType, - encryptionArguments, remark, createTime, lastUpdateTime); + int get hashCode => Object.hash(id, title, password, encryptType, + encryptArguments, remark, createTime, lastUpdateTime); @override bool operator ==(Object other) => identical(this, other) || @@ -2930,8 +2917,8 @@ class PasswordEntity extends DataClass implements Insertable { other.id == this.id && other.title == this.title && other.password == this.password && - other.encryptionType == this.encryptionType && - other.encryptionArguments == this.encryptionArguments && + other.encryptType == this.encryptType && + other.encryptArguments == this.encryptArguments && other.remark == this.remark && other.createTime == this.createTime && other.lastUpdateTime == this.lastUpdateTime); @@ -2941,8 +2928,8 @@ class PasswordsCompanion extends UpdateCompanion { final Value id; final Value title; final Value password; - final Value encryptionType; - final Value encryptionArguments; + final Value encryptType; + final Value encryptArguments; final Value remark; final Value createTime; final Value lastUpdateTime; @@ -2950,8 +2937,8 @@ class PasswordsCompanion extends UpdateCompanion { this.id = const Value.absent(), this.title = const Value.absent(), this.password = const Value.absent(), - this.encryptionType = const Value.absent(), - this.encryptionArguments = const Value.absent(), + this.encryptType = const Value.absent(), + this.encryptArguments = const Value.absent(), this.remark = const Value.absent(), this.createTime = const Value.absent(), this.lastUpdateTime = const Value.absent(), @@ -2960,22 +2947,22 @@ class PasswordsCompanion extends UpdateCompanion { this.id = const Value.absent(), required String title, required String password, - required int encryptionType, - this.encryptionArguments = const Value.absent(), + required int encryptType, + this.encryptArguments = const Value.absent(), this.remark = const Value.absent(), required String createTime, required String lastUpdateTime, }) : title = Value(title), password = Value(password), - encryptionType = Value(encryptionType), + encryptType = Value(encryptType), createTime = Value(createTime), lastUpdateTime = Value(lastUpdateTime); static Insertable custom({ Expression? id, Expression? title, Expression? password, - Expression? encryptionType, - Expression? encryptionArguments, + Expression? encryptType, + Expression? encryptArguments, Expression? remark, Expression? createTime, Expression? lastUpdateTime, @@ -2984,9 +2971,8 @@ class PasswordsCompanion extends UpdateCompanion { if (id != null) 'id': id, if (title != null) 'title': title, if (password != null) 'password': password, - if (encryptionType != null) 'encryption_type': encryptionType, - if (encryptionArguments != null) - 'encryption_arguments': encryptionArguments, + if (encryptType != null) 'encrypt_type': encryptType, + if (encryptArguments != null) 'encrypt_arguments': encryptArguments, if (remark != null) 'remark': remark, if (createTime != null) 'create_time': createTime, if (lastUpdateTime != null) 'last_update_time': lastUpdateTime, @@ -2997,8 +2983,8 @@ class PasswordsCompanion extends UpdateCompanion { {Value? id, Value? title, Value? password, - Value? encryptionType, - Value? encryptionArguments, + Value? encryptType, + Value? encryptArguments, Value? remark, Value? createTime, Value? lastUpdateTime}) { @@ -3006,8 +2992,8 @@ class PasswordsCompanion extends UpdateCompanion { id: id ?? this.id, title: title ?? this.title, password: password ?? this.password, - encryptionType: encryptionType ?? this.encryptionType, - encryptionArguments: encryptionArguments ?? this.encryptionArguments, + encryptType: encryptType ?? this.encryptType, + encryptArguments: encryptArguments ?? this.encryptArguments, remark: remark ?? this.remark, createTime: createTime ?? this.createTime, lastUpdateTime: lastUpdateTime ?? this.lastUpdateTime, @@ -3026,11 +3012,11 @@ class PasswordsCompanion extends UpdateCompanion { if (password.present) { map['password'] = Variable(password.value); } - if (encryptionType.present) { - map['encryption_type'] = Variable(encryptionType.value); + if (encryptType.present) { + map['encrypt_type'] = Variable(encryptType.value); } - if (encryptionArguments.present) { - map['encryption_arguments'] = Variable(encryptionArguments.value); + if (encryptArguments.present) { + map['encrypt_arguments'] = Variable(encryptArguments.value); } if (remark.present) { map['remark'] = Variable(remark.value); @@ -3050,8 +3036,8 @@ class PasswordsCompanion extends UpdateCompanion { ..write('id: $id, ') ..write('title: $title, ') ..write('password: $password, ') - ..write('encryptionType: $encryptionType, ') - ..write('encryptionArguments: $encryptionArguments, ') + ..write('encryptType: $encryptType, ') + ..write('encryptArguments: $encryptArguments, ') ..write('remark: $remark, ') ..write('createTime: $createTime, ') ..write('lastUpdateTime: $lastUpdateTime') diff --git a/editing/lib/database/tables.drift b/editing/lib/database/tables.drift index 4aa2b01..791ec12 100644 --- a/editing/lib/database/tables.drift +++ b/editing/lib/database/tables.drift @@ -9,8 +9,8 @@ CREATE TABLE notes ( location TEXT, weather TEXT, mood TEXT, - encryption_type INTEGER NOT NULL, - encryption_arguments TEXT, + encrypt_type INTEGER NOT NULL, + encrypt_arguments TEXT, create_time TEXT NOT NULL, last_update_time TEXT NOT NULL, category_id INTEGER, @@ -20,8 +20,8 @@ CREATE TABLE notes ( CREATE TABLE categories ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, - encryption_type INTEGER NOT NULL, - encryption_arguments TEXT, + encrypt_type INTEGER NOT NULL, + encrypt_arguments TEXT, create_time TEXT NOT NULL, last_update_time TEXT NOT NULL ) As CategoryEntity; @@ -34,8 +34,8 @@ CREATE TABLE files( thumbnail_path TEXT, format TEXT NOT NULL, checksum TEXT, - encryption_type INTEGER NOT NULL, - encryption_arguments TEXT, + encrypt_type INTEGER NOT NULL, + encrypt_arguments TEXT, remark TEXT, category_id INTEGER, create_time TEXT NOT NULL, @@ -76,8 +76,8 @@ CREATE TABLE passwords ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, password TEXT NOT NULL, - encryption_type INTEGER NOT NULL, - encryption_arguments TEXT, + encrypt_type INTEGER NOT NULL, + encrypt_arguments TEXT, remark TEXT, create_time TEXT NOT NULL, last_update_time TEXT NOT NULL diff --git a/editing/lib/domain/category.dart b/editing/lib/domain/category.dart new file mode 100644 index 0000000..8b12069 --- /dev/null +++ b/editing/lib/domain/category.dart @@ -0,0 +1,31 @@ +import 'package:editing/domain/common.dart'; + +import '../database/database.dart'; + +class Category { + int? id; + String name; + EncryptType encryptType; + String? encryptArguments; + DateTime createTime; + DateTime lastUpdateTime; + + Category( + {this.id, + required this.name, + required this.encryptType, + this.encryptArguments, + required this.createTime, + required this.lastUpdateTime}); + + static Category fromEntity(CategoryEntity entity) { + return Category( + id: entity.id, + name: entity.name, + encryptType: EncryptType.getByValue(entity.encryptType), + encryptArguments: entity.encryptArguments, + createTime: DateTime.parse(entity.createTime), + lastUpdateTime: DateTime.parse(entity.lastUpdateTime), + ); + } +} diff --git a/editing/lib/domain/common.dart b/editing/lib/domain/common.dart new file mode 100644 index 0000000..141a204 --- /dev/null +++ b/editing/lib/domain/common.dart @@ -0,0 +1,12 @@ +enum EncryptType { + plain(0), + aes(1); + + final int value; + + const EncryptType(this.value); + + static EncryptType getByValue(num i) { + return EncryptType.values.firstWhere((x) => x.value == i); + } +} diff --git a/editing/lib/domain/note.dart b/editing/lib/domain/note.dart new file mode 100644 index 0000000..604e8bc --- /dev/null +++ b/editing/lib/domain/note.dart @@ -0,0 +1,111 @@ +import 'package:drift/drift.dart'; +import 'package:editing/domain/category.dart'; + +import '../database/database.dart'; +import 'common.dart'; + +enum NoteType { + journal(1), + note(2), + idea(3), + todo(4); + + final int value; + + const NoteType(this.value); + + static NoteType getByValue(num i) { + return NoteType.values.firstWhere((x) => x.value == i); + } +} + +enum NoteFormat { + plain(0), + quill(1); + + final int value; + + const NoteFormat(this.value); + + static NoteFormat getByValue(num i) { + return NoteFormat.values.firstWhere((x) => x.value == i); + } +} + +class Note { + int? id; + NoteType type; + NoteFormat format; + String title; + String content; + String? abstract; + List? tags; + String? location; + String? weather; + String? mood; + EncryptType encryptType; + String? encryptArguments; + DateTime createTime; + DateTime lastUpdateTime; + Category? category; + + Note( + {this.id, + required this.type, + required this.format, + required this.title, + required this.content, + this.abstract, + this.tags, + this.location, + this.weather, + this.mood, + required this.encryptType, + this.encryptArguments, + required this.createTime, + required this.lastUpdateTime, + this.category}); + + NotesCompanion toCompanion() { + return NotesCompanion( + id: Value.absentIfNull(id), + type: Value(type.value), + format: Value(format.value), + title: Value(title), + content: Value(content), + abstract: Value.absentIfNull(abstract), + tags: Value.absentIfNull(tags?.join(",")), + location: Value.absentIfNull(location), + weather: Value.absentIfNull(weather), + mood: Value.absentIfNull(mood), + encryptType: Value(encryptType.value), + encryptArguments: Value.absentIfNull(encryptArguments), + createTime: Value(createTime.toIso8601String()), + lastUpdateTime: Value(lastUpdateTime.toIso8601String()), + categoryId: Value.absentIfNull(category?.id), + ); + } + + static Note fromEntity(NoteEntity entity, CategoryEntity? category) { + if (entity.categoryId != null) { + assert(category != null && category.id == entity.categoryId); + } + return Note( + id: entity.id, + type: NoteType.getByValue(entity.type), + format: NoteFormat.getByValue(entity.format), + title: entity.title, + content: entity.content, + abstract: entity.abstract, + tags: entity.tags?.split(","), + location: entity.location, + weather: entity.weather, + mood: entity.mood, + encryptType: EncryptType.getByValue(entity.encryptType), + encryptArguments: entity.encryptArguments, + createTime: DateTime.parse(entity.createTime), + lastUpdateTime: DateTime.parse(entity.lastUpdateTime), + category: category != null ? Category.fromEntity(category) : null, + ); + } +} diff --git a/editing/lib/service/note_service.dart b/editing/lib/service/note_service.dart index be68d46..b1c8c65 100644 --- a/editing/lib/service/note_service.dart +++ b/editing/lib/service/note_service.dart @@ -1,6 +1,7 @@ import 'package:drift/drift.dart'; import 'package:editing/database/database.dart'; +import '../domain/note.dart'; import '../store/note_item.dart'; class NoteService { @@ -33,21 +34,27 @@ class NoteService { return items.map(convertToViewModel).toList(); } - Future insert(AppDb db, String title, String content) async { - final now = DateTime.now().toIso8601String(); - final id = await db.into(db.notes).insert(NotesCompanion( - title: Value(title), - content: Value(content), - format: Value(1), - type: Value(1), - encryptionType: Value(1), - createTime: Value(now), - lastUpdateTime: Value(now), - )); - final inserted = await (db.select(db.notes) - ..where((tbl) => tbl.id.equals(id))) - .getSingle(); + Future> fetchByType(AppDb db, NoteType type) async { + final items = await (db.notes.select() + ..where((tbl) => tbl.type.isValue(type.value))) + .get(); + final categories = await db.categories.select().get(); + return items + .map( + (item) => Note.fromEntity( + item, + item.categoryId == null + ? null + : categories.firstWhere((e) => e.id == item.categoryId), + ), + ) + .toList(); + } - return convertToViewModel(inserted); + Future insertNote(AppDb db, Note item) async { + assert(item.id == null); + final id = await db.into(db.notes).insert(item.toCompanion()); + item.id = id; + return item; } } diff --git a/editing/lib/store/note_list.dart b/editing/lib/store/note_list.dart index 276c7af..fdf9dd0 100644 --- a/editing/lib/store/note_list.dart +++ b/editing/lib/store/note_list.dart @@ -36,7 +36,5 @@ abstract class NoteListBase with Store { @action Future insert() async { final db = getDb(); - final inserted = await _noteService.insert(db, "hello", "world"); - list.add(inserted); } } diff --git a/editing/pubspec.lock b/editing/pubspec.lock index bed4104..68550b4 100644 --- a/editing/pubspec.lock +++ b/editing/pubspec.lock @@ -6,7 +6,7 @@ packages: description: name: _fe_analyzer_shared sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "67.0.0" analyzer: @@ -14,7 +14,7 @@ packages: description: name: analyzer sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "6.4.1" analyzer_plugin: @@ -22,7 +22,7 @@ packages: description: name: analyzer_plugin sha256: "9661b30b13a685efaee9f02e5d01ed9f2b423bd889d28a304d02d704aee69161" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.11.3" archive: @@ -30,7 +30,7 @@ packages: description: name: archive sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.4.10" args: @@ -38,7 +38,7 @@ packages: description: name: args sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.4.2" async: @@ -46,7 +46,7 @@ packages: description: name: async sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.11.0" boolean_selector: @@ -54,7 +54,7 @@ packages: description: name: boolean_selector sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.1" build: @@ -62,7 +62,7 @@ packages: description: name: build sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.4.1" build_config: @@ -70,7 +70,7 @@ packages: description: name: build_config sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.1" build_daemon: @@ -78,7 +78,7 @@ packages: description: name: build_daemon sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "4.0.1" build_resolvers: @@ -86,7 +86,7 @@ packages: description: name: build_resolvers sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.4.2" build_runner: @@ -94,7 +94,7 @@ packages: description: name: build_runner sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.4.9" build_runner_core: @@ -102,7 +102,7 @@ packages: description: name: build_runner_core sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "7.3.0" built_collection: @@ -110,7 +110,7 @@ packages: description: name: built_collection sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "5.1.1" built_value: @@ -118,7 +118,7 @@ packages: description: name: built_value sha256: fedde275e0a6b798c3296963c5cd224e3e1b55d0e478d5b7e65e6b540f363a0e - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "8.9.1" characters: @@ -126,7 +126,7 @@ packages: description: name: characters sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.3.0" charcode: @@ -134,7 +134,7 @@ packages: description: name: charcode sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.3.1" checked_yaml: @@ -142,7 +142,7 @@ packages: description: name: checked_yaml sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.0.3" cli_util: @@ -150,7 +150,7 @@ packages: description: name: cli_util sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.4.1" clock: @@ -158,7 +158,7 @@ packages: description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.1" code_builder: @@ -166,7 +166,7 @@ packages: description: name: code_builder sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "4.10.0" collection: @@ -174,7 +174,7 @@ packages: description: name: collection sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.18.0" convert: @@ -182,7 +182,7 @@ packages: description: name: convert sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.1.1" crypto: @@ -190,7 +190,7 @@ packages: description: name: crypto sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.0.3" csslib: @@ -198,7 +198,7 @@ packages: description: name: csslib sha256: "831883fb353c8bdc1d71979e5b342c7d88acfbc643113c14ae51e2442ea0f20f" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.17.3" cupertino_icons: @@ -206,7 +206,7 @@ packages: description: name: cupertino_icons sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.6" dart_quill_delta: @@ -214,7 +214,7 @@ packages: description: name: dart_quill_delta sha256: fe4266508934a4225ede90347a377636eea8bbee8b4a17a17e4bdd8bb9edd3ed - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "9.3.5" dart_style: @@ -222,7 +222,7 @@ packages: description: name: dart_style sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.3.6" device_info_plus: @@ -230,7 +230,7 @@ packages: description: name: device_info_plus sha256: "50fb435ed30c6d2525cbfaaa0f46851ea6131315f213c0d921b0e407b34e3b84" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "10.0.1" device_info_plus_platform_interface: @@ -238,7 +238,7 @@ packages: description: name: device_info_plus_platform_interface sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "7.0.0" diff_match_patch: @@ -246,7 +246,7 @@ packages: description: name: diff_match_patch sha256: "2efc9e6e8f449d0abe15be240e2c2a3bcd977c8d126cfd70598aee60af35c0a4" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.4.1" dio: @@ -254,7 +254,7 @@ packages: description: name: dio sha256: "0978e9a3e45305a80a7210dbeaf79d6ee8bee33f70c8e542dc654c952070217f" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "5.4.2+1" dots_indicator: @@ -262,7 +262,7 @@ packages: description: name: dots_indicator sha256: f1599baa429936ba87f06ae5f2adc920a367b16d08f74db58c3d0f6e93bcdb5c - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.2" drift: @@ -270,7 +270,7 @@ packages: description: name: drift sha256: "3b276c838ff7f8e19aac18a51f9b388715268f3534eaaf8047c8455ef3c1738d" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.16.0" drift_dev: @@ -278,7 +278,7 @@ packages: description: name: drift_dev sha256: "66cf3e397448f855523d7b6b7b3789db232b211db96543a42285464d05f3bf72" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.16.0" equatable: @@ -286,7 +286,7 @@ packages: description: name: equatable sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.0.5" fake_async: @@ -294,7 +294,7 @@ packages: description: name: fake_async sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.3.1" ffi: @@ -302,7 +302,7 @@ packages: description: name: ffi sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.2" file: @@ -310,7 +310,7 @@ packages: description: name: file sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "7.0.0" fixnum: @@ -318,7 +318,7 @@ packages: description: name: fixnum sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.0" fl_chart: @@ -326,7 +326,7 @@ packages: description: name: fl_chart sha256: "00b74ae680df6b1135bdbea00a7d1fc072a9180b7c3f3702e4b19a9943f5ed7d" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.66.2" flutter: @@ -339,7 +339,7 @@ packages: description: name: flutter_colorpicker sha256: "458a6ed8ea480eb16ff892aedb4b7092b2804affd7e046591fb03127e8d8ef8b" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.3" flutter_driver: @@ -352,7 +352,7 @@ packages: description: name: flutter_heatmap_calendar sha256: "0933071844cd604b938e38358984244292ba1ba8f4b4b6f0f091f5927a23e958" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.5" flutter_html: @@ -360,7 +360,7 @@ packages: description: name: flutter_html sha256: "02ad69e813ecfc0728a455e4bf892b9379983e050722b1dce00192ee2e41d1ee" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.0.0-beta.2" flutter_keyboard_visibility: @@ -368,7 +368,7 @@ packages: description: name: flutter_keyboard_visibility sha256: "98664be7be0e3ffca00de50f7f6a287ab62c763fc8c762e0a21584584a3ff4f8" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "6.0.0" flutter_keyboard_visibility_linux: @@ -376,7 +376,7 @@ packages: description: name: flutter_keyboard_visibility_linux sha256: "6fba7cd9bb033b6ddd8c2beb4c99ad02d728f1e6e6d9b9446667398b2ac39f08" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.0" flutter_keyboard_visibility_macos: @@ -384,7 +384,7 @@ packages: description: name: flutter_keyboard_visibility_macos sha256: c5c49b16fff453dfdafdc16f26bdd8fb8d55812a1d50b0ce25fc8d9f2e53d086 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.0" flutter_keyboard_visibility_platform_interface: @@ -392,7 +392,7 @@ packages: description: name: flutter_keyboard_visibility_platform_interface sha256: e43a89845873f7be10cb3884345ceb9aebf00a659f479d1c8f4293fcb37022a4 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.0.0" flutter_keyboard_visibility_web: @@ -400,7 +400,7 @@ packages: description: name: flutter_keyboard_visibility_web sha256: d3771a2e752880c79203f8d80658401d0c998e4183edca05a149f5098ce6e3d1 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.0.0" flutter_keyboard_visibility_windows: @@ -408,7 +408,7 @@ packages: description: name: flutter_keyboard_visibility_windows sha256: fc4b0f0b6be9b93ae527f3d527fb56ee2d918cd88bbca438c478af7bcfd0ef73 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.0" flutter_lints: @@ -416,7 +416,7 @@ packages: description: name: flutter_lints sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.0.2" flutter_localizations: @@ -429,7 +429,7 @@ packages: description: name: flutter_mobx sha256: "859fbf452fa9c2519d2700b125dd7fb14c508bbdd7fb65e26ca8ff6c92280e2e" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.2.1+1" flutter_quill: @@ -437,7 +437,7 @@ packages: description: name: flutter_quill sha256: f8bfe2cfcace3a5b7bc2a40d1a9feb3fefb999ddf88a612d4bb5997ce052e7f3 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "9.3.5" flutter_svg: @@ -445,7 +445,7 @@ packages: description: name: flutter_svg sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.0.10+1" flutter_test: @@ -463,7 +463,7 @@ packages: description: name: frontend_server_client sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "4.0.0" fuchsia_remote_debug_protocol: @@ -476,7 +476,7 @@ packages: description: name: glob sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.2" graphs: @@ -484,7 +484,7 @@ packages: description: name: graphs sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.3.1" html: @@ -492,7 +492,7 @@ packages: description: name: html sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.15.4" html2md: @@ -500,7 +500,7 @@ packages: description: name: html2md sha256: "6f50cec926b0a09816aadb66a59e4cda45c91fd00551e5a8298870069729b508" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.3.1" http: @@ -508,7 +508,7 @@ packages: description: name: http sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.1" http_multi_server: @@ -516,7 +516,7 @@ packages: description: name: http_multi_server sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.2.1" http_parser: @@ -524,7 +524,7 @@ packages: description: name: http_parser sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "4.0.2" integration_test: @@ -537,7 +537,7 @@ packages: description: name: intl sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.18.1" introduction_screen: @@ -545,7 +545,7 @@ packages: description: name: introduction_screen sha256: "325f26e86fa3c3e86e6ab2bbc1fda860c9e6eae5ff29166fc2a3cab8f710d5b5" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.1.14" io: @@ -553,7 +553,7 @@ packages: description: name: io sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.4" irondash_engine_context: @@ -561,7 +561,7 @@ packages: description: name: irondash_engine_context sha256: "4f5e2629296430cce08cdff42e47cef07b8f74a64fdbdfb0525d147bc1a969a2" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.5.2" irondash_message_channel: @@ -569,7 +569,7 @@ packages: description: name: irondash_message_channel sha256: dd581214215dca054bd9873209d690ec3609288c28774cb509dbd86b21180cf8 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.6.0" isolates: @@ -577,7 +577,7 @@ packages: description: name: isolates sha256: ce89e4141b27b877326d3715be2dceac7a7ba89f3229785816d2d318a75ddf28 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.0.3+8" js: @@ -585,7 +585,7 @@ packages: description: name: js sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.6.7" json_annotation: @@ -593,7 +593,7 @@ packages: description: name: json_annotation sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "4.8.1" kdbx: @@ -608,7 +608,7 @@ packages: description: name: l10n_flutter sha256: dbff1d3a97837c8d9095239b2b0014608d30723d28cfb6f97074d96d8f0fdd8e - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.7" leak_tracker: @@ -616,7 +616,7 @@ packages: description: name: leak_tracker sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "10.0.0" leak_tracker_flutter_testing: @@ -624,7 +624,7 @@ packages: description: name: leak_tracker_flutter_testing sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.0.1" leak_tracker_testing: @@ -632,7 +632,7 @@ packages: description: name: leak_tracker_testing sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.0.1" lints: @@ -640,7 +640,7 @@ packages: description: name: lints sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.0.0" list_counter: @@ -648,7 +648,7 @@ packages: description: name: list_counter sha256: c447ae3dfcd1c55f0152867090e67e219d42fe6d4f2807db4bbe8b8d69912237 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.2" logger: @@ -656,7 +656,7 @@ packages: description: name: logger sha256: "8c94b8c219e7e50194efc8771cd0e9f10807d8d3e219af473d89b06cc2ee4e04" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.2.0" logging: @@ -664,7 +664,7 @@ packages: description: name: logging sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.0" logging_appenders: @@ -672,7 +672,7 @@ packages: description: name: logging_appenders sha256: "1fb8a008c04246f4677a0d034d69779a5975e56e02573a5162240239b247e239" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.0+1" markdown: @@ -680,7 +680,7 @@ packages: description: name: markdown sha256: ef2a1298144e3f985cc736b22e0ccdaf188b5b3970648f2d9dc13efd1d9df051 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "7.2.2" matcher: @@ -688,7 +688,7 @@ packages: description: name: matcher sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.12.16+1" material_color_utilities: @@ -696,7 +696,7 @@ packages: description: name: material_color_utilities sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.8.0" meta: @@ -704,7 +704,7 @@ packages: description: name: meta sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.11.0" mime: @@ -712,7 +712,7 @@ packages: description: name: mime sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.5" mobx: @@ -720,7 +720,7 @@ packages: description: name: mobx sha256: "22f8318756329cc2cf4981f6c3f36fc8a61b2846315caa3d6141cf526ecb4fb8" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.3.3+1" mobx_codegen: @@ -728,7 +728,7 @@ packages: description: name: mobx_codegen sha256: "8e0d8653a0c720ad933cd8358f6f89f740ce89203657c13f25bea772ef1fff7c" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.6.1" nested: @@ -736,7 +736,7 @@ packages: description: name: nested sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.0" package_config: @@ -744,7 +744,7 @@ packages: description: name: package_config sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.0" path: @@ -752,7 +752,7 @@ packages: description: name: path sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.9.0" path_parsing: @@ -760,7 +760,7 @@ packages: description: name: path_parsing sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.1" path_provider: @@ -768,7 +768,7 @@ packages: description: name: path_provider sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.2" path_provider_android: @@ -776,7 +776,7 @@ packages: description: name: path_provider_android sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.2.2" path_provider_foundation: @@ -784,7 +784,7 @@ packages: description: name: path_provider_foundation sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.3.2" path_provider_linux: @@ -792,7 +792,7 @@ packages: description: name: path_provider_linux sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.2.1" path_provider_platform_interface: @@ -800,7 +800,7 @@ packages: description: name: path_provider_platform_interface sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.2" path_provider_windows: @@ -808,7 +808,7 @@ packages: description: name: path_provider_windows sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.2.1" petitparser: @@ -816,7 +816,7 @@ packages: description: name: petitparser sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "6.0.2" pixel_snap: @@ -824,7 +824,7 @@ packages: description: name: pixel_snap sha256: "677410ea37b07cd37ecb6d5e6c0d8d7615a7cf3bd92ba406fd1ac57e937d1fb0" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.1.5" platform: @@ -832,7 +832,7 @@ packages: description: name: platform sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.1.4" plugin_platform_interface: @@ -840,7 +840,7 @@ packages: description: name: plugin_platform_interface sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.8" pointycastle: @@ -848,7 +848,7 @@ packages: description: name: pointycastle sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.7.4" pool: @@ -856,7 +856,7 @@ packages: description: name: pool sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.5.1" process: @@ -864,7 +864,7 @@ packages: description: name: process sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "5.0.2" provider: @@ -872,7 +872,7 @@ packages: description: name: provider sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "6.1.2" pub_semver: @@ -880,7 +880,7 @@ packages: description: name: pub_semver sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.4" pubspec_parse: @@ -888,7 +888,7 @@ packages: description: name: pubspec_parse sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.3" quiver: @@ -896,7 +896,7 @@ packages: description: name: quiver sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.2.1" recase: @@ -904,7 +904,7 @@ packages: description: name: recase sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "4.1.0" rive: @@ -912,7 +912,7 @@ packages: description: name: rive sha256: "166019487e8bfa6525d4537bfd494deb4f306e32f97a7f50ff452b44ab6b72ea" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.11.11" rive_common: @@ -920,7 +920,7 @@ packages: description: name: rive_common sha256: "83af8b500ad4d23930397229c7ed520e266eb851690a8621afa6cbd782aeac87" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.2.3" screen_retriever: @@ -928,7 +928,7 @@ packages: description: name: screen_retriever sha256: "6ee02c8a1158e6dae7ca430da79436e3b1c9563c8cf02f524af997c201ac2b90" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.1.9" shelf: @@ -936,7 +936,7 @@ packages: description: name: shelf sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.4.1" shelf_web_socket: @@ -944,7 +944,7 @@ packages: description: name: shelf_web_socket sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.4" sky_engine: @@ -957,7 +957,7 @@ packages: description: name: source_gen sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.5.0" source_span: @@ -965,7 +965,7 @@ packages: description: name: source_span sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.10.0" sprintf: @@ -973,7 +973,7 @@ packages: description: name: sprintf sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "7.0.0" sqlcipher_flutter_libs: @@ -981,7 +981,7 @@ packages: description: name: sqlcipher_flutter_libs sha256: "60fe3444ff5b1b298a9ca3003c6c7f1f7ee4c90aa6035a8647f3aeaf05a073e2" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.6.1" sqlite3: @@ -989,7 +989,7 @@ packages: description: name: sqlite3 sha256: "072128763f1547e3e9b4735ce846bfd226d68019ccda54db4cd427b12dfdedc9" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.4.0" sqlparser: @@ -997,7 +997,7 @@ packages: description: name: sqlparser sha256: "7b20045d1ccfb7bc1df7e8f9fee5ae58673fce6ff62cefbb0e0fd7214e90e5a0" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.34.1" stack_trace: @@ -1005,7 +1005,7 @@ packages: description: name: stack_trace sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.11.1" stream_channel: @@ -1013,7 +1013,7 @@ packages: description: name: stream_channel sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.2" stream_transform: @@ -1021,7 +1021,7 @@ packages: description: name: stream_transform sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.0" string_scanner: @@ -1029,7 +1029,7 @@ packages: description: name: string_scanner sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.0" super_clipboard: @@ -1037,7 +1037,7 @@ packages: description: name: super_clipboard sha256: "42348119cac72f334c33866515a3bc84350aaf72e5d977f1abd35ab44e529dfc" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.8.10" super_native_extensions: @@ -1045,7 +1045,7 @@ packages: description: name: super_native_extensions sha256: abd3b8cb479ca685132472202c70cc11ebb8f4242080f290130d1377bab7cbc1 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.8.10" supercharged_dart: @@ -1053,7 +1053,7 @@ packages: description: name: supercharged_dart sha256: cb95edda32eacd27664089700a750120be41daa84aa6cd2aeded46227c16b867 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.1" sync_http: @@ -1061,7 +1061,7 @@ packages: description: name: sync_http sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.3.1" synchronized: @@ -1069,7 +1069,7 @@ packages: description: name: synchronized sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.1.0+1" term_glyph: @@ -1077,7 +1077,7 @@ packages: description: name: term_glyph sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: @@ -1085,7 +1085,7 @@ packages: description: name: test_api sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.6.1" timing: @@ -1093,7 +1093,7 @@ packages: description: name: timing sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.1" typed_data: @@ -1101,7 +1101,7 @@ packages: description: name: typed_data sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.3.2" url_launcher: @@ -1109,7 +1109,7 @@ packages: description: name: url_launcher sha256: "0ecc004c62fd3ed36a2ffcbe0dd9700aee63bd7532d0b642a488b1ec310f492e" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "6.2.5" url_launcher_android: @@ -1117,7 +1117,7 @@ packages: description: name: url_launcher_android sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "6.3.0" url_launcher_ios: @@ -1125,7 +1125,7 @@ packages: description: name: url_launcher_ios sha256: "9149d493b075ed740901f3ee844a38a00b33116c7c5c10d7fb27df8987fb51d5" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "6.2.5" url_launcher_linux: @@ -1133,7 +1133,7 @@ packages: description: name: url_launcher_linux sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.1.1" url_launcher_macos: @@ -1141,7 +1141,7 @@ packages: description: name: url_launcher_macos sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.1.0" url_launcher_platform_interface: @@ -1149,7 +1149,7 @@ packages: description: name: url_launcher_platform_interface sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.3.2" url_launcher_web: @@ -1157,7 +1157,7 @@ packages: description: name: url_launcher_web sha256: "3692a459204a33e04bc94f5fb91158faf4f2c8903281ddd82915adecdb1a901d" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.3.0" url_launcher_windows: @@ -1165,7 +1165,7 @@ packages: description: name: url_launcher_windows sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.1.1" uuid: @@ -1173,7 +1173,7 @@ packages: description: name: uuid sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "4.3.3" vector_graphics: @@ -1181,7 +1181,7 @@ packages: description: name: vector_graphics sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.11+1" vector_graphics_codec: @@ -1189,7 +1189,7 @@ packages: description: name: vector_graphics_codec sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.11+1" vector_graphics_compiler: @@ -1197,7 +1197,7 @@ packages: description: name: vector_graphics_compiler sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.11+1" vector_math: @@ -1205,7 +1205,7 @@ packages: description: name: vector_math sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.4" vm_service: @@ -1213,7 +1213,7 @@ packages: description: name: vm_service sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "13.0.0" watcher: @@ -1221,7 +1221,7 @@ packages: description: name: watcher sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.0" web: @@ -1229,7 +1229,7 @@ packages: description: name: web sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.5.1" web_socket_channel: @@ -1237,7 +1237,7 @@ packages: description: name: web_socket_channel sha256: "1d8e795e2a8b3730c41b8a98a2dff2e0fb57ae6f0764a1c46ec5915387d257b2" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.4.4" webdriver: @@ -1245,23 +1245,23 @@ packages: description: name: webdriver sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.0.3" win32: dependency: transitive description: name: win32 - sha256: "8cb58b45c47dcb42ab3651533626161d6b67a2921917d8d429791f76972b3480" - url: "https://pub.flutter-io.cn" + sha256: "0a989dc7ca2bb51eac91e8fd00851297cfffd641aa7538b165c62637ca0eaa4a" + url: "https://pub.dev" source: hosted - version: "5.3.0" + version: "5.4.0" win32_registry: dependency: transitive description: name: win32_registry sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.2" window_manager: @@ -1269,7 +1269,7 @@ packages: description: name: window_manager sha256: b3c895bdf936c77b83c5254bec2e6b3f066710c1f89c38b20b8acc382b525494 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.3.8" xdg_directories: @@ -1277,7 +1277,7 @@ packages: description: name: xdg_directories sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.4" xml: @@ -1285,7 +1285,7 @@ packages: description: name: xml sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "6.5.0" yaml: @@ -1293,7 +1293,7 @@ packages: description: name: yaml sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.1.2" sdks: diff --git a/editing/test/database/database_test.dart b/editing/test/database/database_test.dart index d0ad7ad..0597159 100644 --- a/editing/test/database/database_test.dart +++ b/editing/test/database/database_test.dart @@ -9,31 +9,25 @@ import 'package:drift/native.dart'; import 'package:editing/database/database.dart'; import 'package:flutter_test/flutter_test.dart'; +import '../test_util/database_helper.dart'; + void main() { late AppDb database; - setUp(() { + setUp(() async { database = AppDb.from(NativeDatabase.memory()); + await database.select(database.notes).get(); // ensure drift is initiallized + + final helper = DatabaseHelper(database); + await helper.createCategory(1, "test"); }); tearDown(() async { await database.close(); }); - test('should initialize app configuration when database is created', - () async { - // final list = await database.select(database.configuration).get(); - // expect(list.length, 3); - // expect(list[0].name, "APP_VERSION"); - // expect(list[1].name, "SQLCIPHER_VERSION"); - // expect(list[2].name, "SEED"); - // expect(list[0].value, "0.1"); - // expect(list[1].value, '4.5.6 community'); - // expect(list[2].value, isNotEmpty); - }); - - test('should get all notes', () async { - final list = await database.select(database.notes).get(); - expect(list.length, 0); + test('should get all categories', () async { + final list = await database.select(database.categories).get(); + expect(list.length, 1); }); } diff --git a/editing/test/services/kdbx_service_test.dart b/editing/test/services/kdbx_service_test.dart index 72cacd5..479336b 100644 --- a/editing/test/services/kdbx_service_test.dart +++ b/editing/test/services/kdbx_service_test.dart @@ -18,11 +18,6 @@ void main() { file.body.rootGroup.entries[0] .getString(KdbxKeyCommon.TITLE) ?.getText(), - "APP_VERSION"); - expect( - file.body.rootGroup.entries[0] - .getString(KdbxKeyCommon.PASSWORD) - ?.getText(), - startsWith("\$argon2id")); + "CONFIG"); }); } diff --git a/editing/test/services/note_service_test.dart b/editing/test/services/note_service_test.dart new file mode 100644 index 0000000..e7f2aab --- /dev/null +++ b/editing/test/services/note_service_test.dart @@ -0,0 +1,46 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:drift/native.dart'; +import 'package:editing/database/database.dart'; +import 'package:editing/domain/note.dart'; +import 'package:editing/service/note_service.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../test_util/database_helper.dart'; + +void main() { + late AppDb database; + final service = NoteService(); + + setUp(() async { + database = AppDb.from(NativeDatabase.memory()); + await database.select(database.notes).get(); // ensure drift is initiallized + + final helper = DatabaseHelper(database); + await helper.createCategory(1, "test1"); + await helper.createCategory(2, "test2"); + await helper.createNote(1, "hello", "hello, this is my first note"); + await helper.createNote(2, "2022/3/5", "Today is really a good day!"); + await helper.createNote(3, "New idea", "I want to create a new flutter app", + type: NoteType.idea.value); + }); + + tearDown(() async { + await database.close(); + }); + + test('should get all notes by type', () async { + final list = await service.fetchByType(database, NoteType.journal); + expect(list.length, 2); + expect(list[1].type, NoteType.journal); + + final list1 = await service.fetchByType(database, NoteType.idea); + expect(list1.length, 1); + expect(list1[0].type, NoteType.idea); + }); +} diff --git a/editing/test/test_util/database_helper.dart b/editing/test/test_util/database_helper.dart new file mode 100644 index 0000000..0481392 --- /dev/null +++ b/editing/test/test_util/database_helper.dart @@ -0,0 +1,35 @@ +import 'package:editing/database/database.dart'; + +class DatabaseHelper { + final AppDb database; + + DatabaseHelper(this.database); + + Future createCategory(int id, String name) async { + const sql = """ + insert into categories(id, name, encrypt_type, encrypt_arguments, create_time, last_update_time) + values + (?, ?, 0, null, ?, ?) + """; + const date = '2024-03-30T17:27:20.933'; + final List objs = [id, name, date, date]; + return database.executor.runInsert(sql, objs); + } + + Future createNote(int id, String title, String content, + {int? type}) async { + const sql = """ + insert into notes(id, type, format, title, content, abstract, tags, location, weather, mood, encrypt_type, encrypt_arguments, create_time, last_update_time, category_id) + values + (?, ?, 1, ?, ?, ?, null, 'Wuhan', null, 'Happy', 0, null, '2024-03-30T17:27:20.933', '2024-03-30T17:27:20.933', null); + """; + final List objs = [ + id, + type ?? 1, + title, + content, + content.substring(0, 10) + ]; + return database.executor.runInsert(sql, objs); + } +}