From f642530bca3e50898960531cc369b3208425e633 Mon Sep 17 00:00:00 2001 From: ZhuJHua <1624109111@qq.com> Date: Fri, 18 Apr 2025 11:18:20 +0800 Subject: [PATCH 1/3] feat: integrate Jieba for keyword extraction and search optimization --- analysis_options.yaml | 2 + flutter_rust_bridge.yaml | 3 +- lib/common/models/isar/diary.dart | 16 + lib/common/models/isar/diary.g.dart | 754 +++++++++++++--- lib/components/base/image.dart | 3 +- lib/components/base/sheet.dart | 6 +- .../search_card/search_card_logic.dart | 16 - .../search_card/search_card_state.dart | 5 - .../search_card/search_card_view.dart | 139 ++- .../search_sheet/search_sheet_logic.dart | 99 +- .../search_sheet/search_sheet_state.dart | 4 + .../search_sheet/search_sheet_view.dart | 89 +- lib/pages/edit/edit_logic.dart | 15 +- lib/pages/laboratory/laboratory_logic.dart | 10 + lib/pages/laboratory/laboratory_view.dart | 12 + lib/persistence/isar.dart | 82 +- lib/src/rust/api/aes.dart | 3 +- lib/src/rust/api/compress.dart | 22 +- lib/src/rust/api/constants.dart | 3 +- lib/src/rust/api/font.dart | 3 +- lib/src/rust/api/jieba.dart | 58 ++ lib/src/rust/api/kmp.dart | 3 +- lib/src/rust/api/zip.dart | 3 +- lib/src/rust/frb_generated.dart | 842 +++++++++++++++--- lib/src/rust/frb_generated.io.dart | 292 ++++-- lib/src/rust/frb_generated.web.dart | 774 ---------------- pubspec.lock | 128 +-- pubspec.yaml | 15 +- rust/Cargo.lock | 312 ++++++- rust/Cargo.toml | 3 + rust/src/api/compress.rs | 14 +- rust/src/api/jieba.rs | 126 +++ rust/src/api/mod.rs | 3 +- rust/src/frb_generated.rs | 841 ++++++++++++----- 34 files changed, 3090 insertions(+), 1610 deletions(-) delete mode 100644 lib/components/search_card/search_card_logic.dart delete mode 100644 lib/components/search_card/search_card_state.dart create mode 100644 lib/src/rust/api/jieba.dart delete mode 100644 lib/src/rust/frb_generated.web.dart create mode 100644 rust/src/api/jieba.rs diff --git a/analysis_options.yaml b/analysis_options.yaml index 99f5ff0..f4455b2 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -20,3 +20,5 @@ analyzer: - "android/**" - "windows/**" - "macos/**" + errors: + invalid_annotation_target: ignore diff --git a/flutter_rust_bridge.yaml b/flutter_rust_bridge.yaml index e15ed91..3e1550c 100644 --- a/flutter_rust_bridge.yaml +++ b/flutter_rust_bridge.yaml @@ -1,3 +1,4 @@ rust_input: crate::api rust_root: rust/ -dart_output: lib/src/rust \ No newline at end of file +dart_output: lib/src/rust +web: false \ No newline at end of file diff --git a/lib/common/models/isar/diary.dart b/lib/common/models/isar/diary.dart index 56ac048..ce4662d 100644 --- a/lib/common/models/isar/diary.dart +++ b/lib/common/models/isar/diary.dart @@ -67,6 +67,12 @@ class Diary { // 位置信息 List position = []; + // 关键词 + List keywords = []; + + // 分词 + List tokenizer = []; + // 类型,富文本还是纯文本,不会为空,延迟加载 late String type; @@ -97,6 +103,8 @@ class Diary { const ListEquality().equals(videoName, other.videoName) && const ListEquality().equals(tags, other.tags) && const ListEquality().equals(position, other.position) && + const ListEquality().equals(keywords, other.keywords) && + const ListEquality().equals(tokenizer, other.tokenizer) && type == other.type && imageColor == other.imageColor && aspect == other.aspect; @@ -118,6 +126,8 @@ class Diary { const ListEquality().hash(videoName) ^ const ListEquality().hash(tags) ^ const ListEquality().hash(position) ^ + const ListEquality().hash(keywords) ^ + const ListEquality().hash(tokenizer) ^ type.hashCode ^ imageColor.hashCode ^ aspect.hashCode; @@ -145,6 +155,8 @@ class Diary { ..videoName = List.from(videoName) ..tags = List.from(tags) ..position = List.from(position) + ..keywords = List.from(keywords) + ..tokenizer = List.from(tokenizer) ..type = type ..imageColor = imageColor ..aspect = aspect; @@ -168,6 +180,8 @@ class Diary { 'videoName': videoName, 'tags': tags, 'position': position, + 'keywords': keywords, + 'tokenizer': tokenizer, 'type': type, 'imageColor': imageColor, 'aspect': aspect, @@ -191,6 +205,8 @@ class Diary { ..videoName = List.from(json['videoName'] as List) ..tags = List.from(json['tags'] as List) ..position = List.from(json['position'] as List) + ..keywords = List.from(json['keywords'] as List) + ..tokenizer = List.from(json['tokenizer'] as List) ..type = json['type'] as String ..imageColor = json['imageColor'] as int? ..aspect = (json['aspect'] as num?)?.toDouble(); diff --git a/lib/common/models/isar/diary.g.dart b/lib/common/models/isar/diary.g.dart index 172d834..3057d7b 100644 --- a/lib/common/models/isar/diary.g.dart +++ b/lib/common/models/isar/diary.g.dart @@ -35,6 +35,8 @@ const DiarySchema = IsarGeneratedSchema( IsarPropertySchema(name: 'videoName', type: IsarType.stringList), IsarPropertySchema(name: 'tags', type: IsarType.stringList), IsarPropertySchema(name: 'position', type: IsarType.stringList), + IsarPropertySchema(name: 'keywords', type: IsarType.stringList), + IsarPropertySchema(name: 'tokenizer', type: IsarType.stringList), IsarPropertySchema(name: 'type', type: IsarType.string), IsarPropertySchema(name: 'imageColor', type: IsarType.long), IsarPropertySchema(name: 'aspect', type: IsarType.double), @@ -152,11 +154,27 @@ int serializeDiary(IsarWriter writer, Diary object) { } IsarCore.endList(writer, listWriter); } - IsarCore.writeString(writer, 16, object.type); - IsarCore.writeLong(writer, 17, object.imageColor ?? -9223372036854775808); - IsarCore.writeDouble(writer, 18, object.aspect ?? double.nan); - IsarCore.writeString(writer, 19, object.yM); - IsarCore.writeString(writer, 20, object.yMd); + { + final list = object.keywords; + final listWriter = IsarCore.beginList(writer, 16, list.length); + for (var i = 0; i < list.length; i++) { + IsarCore.writeString(listWriter, i, list[i]); + } + IsarCore.endList(writer, listWriter); + } + { + final list = object.tokenizer; + final listWriter = IsarCore.beginList(writer, 17, list.length); + for (var i = 0; i < list.length; i++) { + IsarCore.writeString(listWriter, i, list[i]); + } + IsarCore.endList(writer, listWriter); + } + IsarCore.writeString(writer, 18, object.type); + IsarCore.writeLong(writer, 19, object.imageColor ?? -9223372036854775808); + IsarCore.writeDouble(writer, 20, object.aspect ?? double.nan); + IsarCore.writeString(writer, 21, object.yM); + IsarCore.writeString(writer, 22, object.yMd); return object.isarId; } @@ -286,9 +304,41 @@ Diary deserializeDiary(IsarReader reader) { } } } - object.type = IsarCore.readString(reader, 16) ?? ''; { - final value = IsarCore.readLong(reader, 17); + final length = IsarCore.readList(reader, 16, IsarCore.readerPtrPtr); + { + final reader = IsarCore.readerPtr; + if (reader.isNull) { + object.keywords = const []; + } else { + final list = List.filled(length, '', growable: true); + for (var i = 0; i < length; i++) { + list[i] = IsarCore.readString(reader, i) ?? ''; + } + IsarCore.freeReader(reader); + object.keywords = list; + } + } + } + { + final length = IsarCore.readList(reader, 17, IsarCore.readerPtrPtr); + { + final reader = IsarCore.readerPtr; + if (reader.isNull) { + object.tokenizer = const []; + } else { + final list = List.filled(length, '', growable: true); + for (var i = 0; i < length; i++) { + list[i] = IsarCore.readString(reader, i) ?? ''; + } + IsarCore.freeReader(reader); + object.tokenizer = list; + } + } + } + object.type = IsarCore.readString(reader, 18) ?? ''; + { + final value = IsarCore.readLong(reader, 19); if (value == -9223372036854775808) { object.imageColor = null; } else { @@ -296,7 +346,7 @@ Diary deserializeDiary(IsarReader reader) { } } { - final value = IsarCore.readDouble(reader, 18); + final value = IsarCore.readDouble(reader, 20); if (value.isNaN) { object.aspect = null; } else { @@ -450,19 +500,53 @@ dynamic deserializeDiaryProp(IsarReader reader, int property) { } } case 16: - return IsarCore.readString(reader, 16) ?? ''; + { + final length = IsarCore.readList(reader, 16, IsarCore.readerPtrPtr); + { + final reader = IsarCore.readerPtr; + if (reader.isNull) { + return const []; + } else { + final list = List.filled(length, '', growable: true); + for (var i = 0; i < length; i++) { + list[i] = IsarCore.readString(reader, i) ?? ''; + } + IsarCore.freeReader(reader); + return list; + } + } + } case 17: { - final value = IsarCore.readLong(reader, 17); + final length = IsarCore.readList(reader, 17, IsarCore.readerPtrPtr); + { + final reader = IsarCore.readerPtr; + if (reader.isNull) { + return const []; + } else { + final list = List.filled(length, '', growable: true); + for (var i = 0; i < length; i++) { + list[i] = IsarCore.readString(reader, i) ?? ''; + } + IsarCore.freeReader(reader); + return list; + } + } + } + case 18: + return IsarCore.readString(reader, 18) ?? ''; + case 19: + { + final value = IsarCore.readLong(reader, 19); if (value == -9223372036854775808) { return null; } else { return value; } } - case 18: + case 20: { - final value = IsarCore.readDouble(reader, 18); + final value = IsarCore.readDouble(reader, 20); if (value.isNaN) { return null; } else { @@ -471,10 +555,10 @@ dynamic deserializeDiaryProp(IsarReader reader, int property) { } case 0: return IsarCore.readId(reader); - case 19: - return IsarCore.readString(reader, 19) ?? ''; - case 20: - return IsarCore.readString(reader, 20) ?? ''; + case 21: + return IsarCore.readString(reader, 21) ?? ''; + case 22: + return IsarCore.readString(reader, 22) ?? ''; default: throw ArgumentError('Unknown property: $property'); } @@ -535,11 +619,11 @@ class _DiaryUpdateImpl implements _DiaryUpdate { if (lastModified != ignore) 7: lastModified as DateTime?, if (show != ignore) 8: show as bool?, if (mood != ignore) 9: mood as double?, - if (type != ignore) 16: type as String?, - if (imageColor != ignore) 17: imageColor as int?, - if (aspect != ignore) 18: aspect as double?, - if (yM != ignore) 19: yM as String?, - if (yMd != ignore) 20: yMd as String?, + if (type != ignore) 18: type as String?, + if (imageColor != ignore) 19: imageColor as int?, + if (aspect != ignore) 20: aspect as double?, + if (yM != ignore) 21: yM as String?, + if (yMd != ignore) 22: yMd as String?, }, ) > 0; @@ -599,11 +683,11 @@ class _DiaryUpdateAllImpl implements _DiaryUpdateAll { if (lastModified != ignore) 7: lastModified as DateTime?, if (show != ignore) 8: show as bool?, if (mood != ignore) 9: mood as double?, - if (type != ignore) 16: type as String?, - if (imageColor != ignore) 17: imageColor as int?, - if (aspect != ignore) 18: aspect as double?, - if (yM != ignore) 19: yM as String?, - if (yMd != ignore) 20: yMd as String?, + if (type != ignore) 18: type as String?, + if (imageColor != ignore) 19: imageColor as int?, + if (aspect != ignore) 20: aspect as double?, + if (yM != ignore) 21: yM as String?, + if (yMd != ignore) 22: yMd as String?, }); } } @@ -666,11 +750,11 @@ class _DiaryQueryUpdateImpl implements _DiaryQueryUpdate { if (lastModified != ignore) 7: lastModified as DateTime?, if (show != ignore) 8: show as bool?, if (mood != ignore) 9: mood as double?, - if (type != ignore) 16: type as String?, - if (imageColor != ignore) 17: imageColor as int?, - if (aspect != ignore) 18: aspect as double?, - if (yM != ignore) 19: yM as String?, - if (yMd != ignore) 20: yMd as String?, + if (type != ignore) 18: type as String?, + if (imageColor != ignore) 19: imageColor as int?, + if (aspect != ignore) 20: aspect as double?, + if (yM != ignore) 21: yM as String?, + if (yMd != ignore) 22: yMd as String?, }); } } @@ -716,11 +800,11 @@ class _DiaryQueryBuilderUpdateImpl implements _DiaryQueryUpdate { if (lastModified != ignore) 7: lastModified as DateTime?, if (show != ignore) 8: show as bool?, if (mood != ignore) 9: mood as double?, - if (type != ignore) 16: type as String?, - if (imageColor != ignore) 17: imageColor as int?, - if (aspect != ignore) 18: aspect as double?, - if (yM != ignore) 19: yM as String?, - if (yMd != ignore) 20: yMd as String?, + if (type != ignore) 18: type as String?, + if (imageColor != ignore) 19: imageColor as int?, + if (aspect != ignore) 20: aspect as double?, + if (yM != ignore) 21: yM as String?, + if (yMd != ignore) 22: yMd as String?, }); } finally { q.close(); @@ -1732,6 +1816,7 @@ extension DiaryQueryFilter on QueryBuilder { property: 9, lower: lower, upper: upper, + epsilon: epsilon, ), ); @@ -2789,7 +2874,7 @@ extension DiaryQueryFilter on QueryBuilder { }); } - QueryBuilder typeEqualTo( + QueryBuilder keywordsElementEqualTo( String value, { bool caseSensitive = true, }) { @@ -2804,7 +2889,7 @@ extension DiaryQueryFilter on QueryBuilder { }); } - QueryBuilder typeGreaterThan( + QueryBuilder keywordsElementGreaterThan( String value, { bool caseSensitive = true, }) { @@ -2819,7 +2904,8 @@ extension DiaryQueryFilter on QueryBuilder { }); } - QueryBuilder typeGreaterThanOrEqualTo( + QueryBuilder + keywordsElementGreaterThanOrEqualTo( String value, { bool caseSensitive = true, }) { @@ -2834,7 +2920,7 @@ extension DiaryQueryFilter on QueryBuilder { }); } - QueryBuilder typeLessThan( + QueryBuilder keywordsElementLessThan( String value, { bool caseSensitive = true, }) { @@ -2845,10 +2931,8 @@ extension DiaryQueryFilter on QueryBuilder { }); } - QueryBuilder typeLessThanOrEqualTo( - String value, { - bool caseSensitive = true, - }) { + QueryBuilder + keywordsElementLessThanOrEqualTo(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( LessOrEqualCondition( @@ -2860,7 +2944,7 @@ extension DiaryQueryFilter on QueryBuilder { }); } - QueryBuilder typeBetween( + QueryBuilder keywordsElementBetween( String lower, String upper, { bool caseSensitive = true, @@ -2877,7 +2961,7 @@ extension DiaryQueryFilter on QueryBuilder { }); } - QueryBuilder typeStartsWith( + QueryBuilder keywordsElementStartsWith( String value, { bool caseSensitive = true, }) { @@ -2892,7 +2976,7 @@ extension DiaryQueryFilter on QueryBuilder { }); } - QueryBuilder typeEndsWith( + QueryBuilder keywordsElementEndsWith( String value, { bool caseSensitive = true, }) { @@ -2907,7 +2991,7 @@ extension DiaryQueryFilter on QueryBuilder { }); } - QueryBuilder typeContains( + QueryBuilder keywordsElementContains( String value, { bool caseSensitive = true, }) { @@ -2922,7 +3006,7 @@ extension DiaryQueryFilter on QueryBuilder { }); } - QueryBuilder typeMatches( + QueryBuilder keywordsElementMatches( String pattern, { bool caseSensitive = true, }) { @@ -2937,7 +3021,7 @@ extension DiaryQueryFilter on QueryBuilder { }); } - QueryBuilder typeIsEmpty() { + QueryBuilder keywordsElementIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( const EqualCondition(property: 16, value: ''), @@ -2945,7 +3029,8 @@ extension DiaryQueryFilter on QueryBuilder { }); } - QueryBuilder typeIsNotEmpty() { + QueryBuilder + keywordsElementIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( const GreaterCondition(property: 16, value: ''), @@ -2953,15 +3038,367 @@ extension DiaryQueryFilter on QueryBuilder { }); } + QueryBuilder keywordsIsEmpty() { + return not().keywordsIsNotEmpty(); + } + + QueryBuilder keywordsIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + const GreaterOrEqualCondition(property: 16, value: null), + ); + }); + } + + QueryBuilder tokenizerElementEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + EqualCondition( + property: 17, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder tokenizerElementGreaterThan( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + GreaterCondition( + property: 17, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder + tokenizerElementGreaterThanOrEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + GreaterOrEqualCondition( + property: 17, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder tokenizerElementLessThan( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + LessCondition(property: 17, value: value, caseSensitive: caseSensitive), + ); + }); + } + + QueryBuilder + tokenizerElementLessThanOrEqualTo(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + LessOrEqualCondition( + property: 17, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder tokenizerElementBetween( + String lower, + String upper, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + BetweenCondition( + property: 17, + lower: lower, + upper: upper, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder tokenizerElementStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + StartsWithCondition( + property: 17, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder tokenizerElementEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + EndsWithCondition( + property: 17, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder tokenizerElementContains( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + ContainsCondition( + property: 17, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder tokenizerElementMatches( + String pattern, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + MatchesCondition( + property: 17, + wildcard: pattern, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder tokenizerElementIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + const EqualCondition(property: 17, value: ''), + ); + }); + } + + QueryBuilder + tokenizerElementIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + const GreaterCondition(property: 17, value: ''), + ); + }); + } + + QueryBuilder tokenizerIsEmpty() { + return not().tokenizerIsNotEmpty(); + } + + QueryBuilder tokenizerIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + const GreaterOrEqualCondition(property: 17, value: null), + ); + }); + } + + QueryBuilder typeEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + EqualCondition( + property: 18, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder typeGreaterThan( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + GreaterCondition( + property: 18, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder typeGreaterThanOrEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + GreaterOrEqualCondition( + property: 18, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder typeLessThan( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + LessCondition(property: 18, value: value, caseSensitive: caseSensitive), + ); + }); + } + + QueryBuilder typeLessThanOrEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + LessOrEqualCondition( + property: 18, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder typeBetween( + String lower, + String upper, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + BetweenCondition( + property: 18, + lower: lower, + upper: upper, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder typeStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + StartsWithCondition( + property: 18, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder typeEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + EndsWithCondition( + property: 18, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder typeContains( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + ContainsCondition( + property: 18, + value: value, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder typeMatches( + String pattern, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + MatchesCondition( + property: 18, + wildcard: pattern, + caseSensitive: caseSensitive, + ), + ); + }); + } + + QueryBuilder typeIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + const EqualCondition(property: 18, value: ''), + ); + }); + } + + QueryBuilder typeIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition( + const GreaterCondition(property: 18, value: ''), + ); + }); + } + QueryBuilder imageColorIsNull() { return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(const IsNullCondition(property: 17)); + return query.addFilterCondition(const IsNullCondition(property: 19)); }); } QueryBuilder imageColorIsNotNull() { return QueryBuilder.apply(not(), (query) { - return query.addFilterCondition(const IsNullCondition(property: 17)); + return query.addFilterCondition(const IsNullCondition(property: 19)); }); } @@ -2970,7 +3407,7 @@ extension DiaryQueryFilter on QueryBuilder { ) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - EqualCondition(property: 17, value: value), + EqualCondition(property: 19, value: value), ); }); } @@ -2980,7 +3417,7 @@ extension DiaryQueryFilter on QueryBuilder { ) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - GreaterCondition(property: 17, value: value), + GreaterCondition(property: 19, value: value), ); }); } @@ -2989,7 +3426,7 @@ extension DiaryQueryFilter on QueryBuilder { imageColorGreaterThanOrEqualTo(int? value) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - GreaterOrEqualCondition(property: 17, value: value), + GreaterOrEqualCondition(property: 19, value: value), ); }); } @@ -2999,7 +3436,7 @@ extension DiaryQueryFilter on QueryBuilder { ) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - LessCondition(property: 17, value: value), + LessCondition(property: 19, value: value), ); }); } @@ -3009,7 +3446,7 @@ extension DiaryQueryFilter on QueryBuilder { ) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - LessOrEqualCondition(property: 17, value: value), + LessOrEqualCondition(property: 19, value: value), ); }); } @@ -3020,20 +3457,20 @@ extension DiaryQueryFilter on QueryBuilder { ) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - BetweenCondition(property: 17, lower: lower, upper: upper), + BetweenCondition(property: 19, lower: lower, upper: upper), ); }); } QueryBuilder aspectIsNull() { return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(const IsNullCondition(property: 18)); + return query.addFilterCondition(const IsNullCondition(property: 20)); }); } QueryBuilder aspectIsNotNull() { return QueryBuilder.apply(not(), (query) { - return query.addFilterCondition(const IsNullCondition(property: 18)); + return query.addFilterCondition(const IsNullCondition(property: 20)); }); } @@ -3043,7 +3480,7 @@ extension DiaryQueryFilter on QueryBuilder { }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - EqualCondition(property: 18, value: value, epsilon: epsilon), + EqualCondition(property: 20, value: value, epsilon: epsilon), ); }); } @@ -3054,7 +3491,7 @@ extension DiaryQueryFilter on QueryBuilder { }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - GreaterCondition(property: 18, value: value, epsilon: epsilon), + GreaterCondition(property: 20, value: value, epsilon: epsilon), ); }); } @@ -3065,7 +3502,7 @@ extension DiaryQueryFilter on QueryBuilder { }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - GreaterOrEqualCondition(property: 18, value: value, epsilon: epsilon), + GreaterOrEqualCondition(property: 20, value: value, epsilon: epsilon), ); }); } @@ -3076,7 +3513,7 @@ extension DiaryQueryFilter on QueryBuilder { }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - LessCondition(property: 18, value: value, epsilon: epsilon), + LessCondition(property: 20, value: value, epsilon: epsilon), ); }); } @@ -3087,7 +3524,7 @@ extension DiaryQueryFilter on QueryBuilder { }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - LessOrEqualCondition(property: 18, value: value, epsilon: epsilon), + LessOrEqualCondition(property: 20, value: value, epsilon: epsilon), ); }); } @@ -3100,9 +3537,10 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( BetweenCondition( - property: 18, + property: 20, lower: lower, upper: upper, + epsilon: epsilon, ), ); @@ -3171,7 +3609,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( EqualCondition( - property: 19, + property: 21, value: value, caseSensitive: caseSensitive, ), @@ -3186,7 +3624,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( GreaterCondition( - property: 19, + property: 21, value: value, caseSensitive: caseSensitive, ), @@ -3201,7 +3639,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( GreaterOrEqualCondition( - property: 19, + property: 21, value: value, caseSensitive: caseSensitive, ), @@ -3215,7 +3653,7 @@ extension DiaryQueryFilter on QueryBuilder { }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - LessCondition(property: 19, value: value, caseSensitive: caseSensitive), + LessCondition(property: 21, value: value, caseSensitive: caseSensitive), ); }); } @@ -3227,7 +3665,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( LessOrEqualCondition( - property: 19, + property: 21, value: value, caseSensitive: caseSensitive, ), @@ -3243,7 +3681,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( BetweenCondition( - property: 19, + property: 21, lower: lower, upper: upper, caseSensitive: caseSensitive, @@ -3259,7 +3697,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( StartsWithCondition( - property: 19, + property: 21, value: value, caseSensitive: caseSensitive, ), @@ -3274,7 +3712,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( EndsWithCondition( - property: 19, + property: 21, value: value, caseSensitive: caseSensitive, ), @@ -3289,7 +3727,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( ContainsCondition( - property: 19, + property: 21, value: value, caseSensitive: caseSensitive, ), @@ -3304,7 +3742,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( MatchesCondition( - property: 19, + property: 21, wildcard: pattern, caseSensitive: caseSensitive, ), @@ -3315,7 +3753,7 @@ extension DiaryQueryFilter on QueryBuilder { QueryBuilder yMIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - const EqualCondition(property: 19, value: ''), + const EqualCondition(property: 21, value: ''), ); }); } @@ -3323,7 +3761,7 @@ extension DiaryQueryFilter on QueryBuilder { QueryBuilder yMIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - const GreaterCondition(property: 19, value: ''), + const GreaterCondition(property: 21, value: ''), ); }); } @@ -3335,7 +3773,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( EqualCondition( - property: 20, + property: 22, value: value, caseSensitive: caseSensitive, ), @@ -3350,7 +3788,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( GreaterCondition( - property: 20, + property: 22, value: value, caseSensitive: caseSensitive, ), @@ -3365,7 +3803,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( GreaterOrEqualCondition( - property: 20, + property: 22, value: value, caseSensitive: caseSensitive, ), @@ -3379,7 +3817,7 @@ extension DiaryQueryFilter on QueryBuilder { }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - LessCondition(property: 20, value: value, caseSensitive: caseSensitive), + LessCondition(property: 22, value: value, caseSensitive: caseSensitive), ); }); } @@ -3391,7 +3829,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( LessOrEqualCondition( - property: 20, + property: 22, value: value, caseSensitive: caseSensitive, ), @@ -3407,7 +3845,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( BetweenCondition( - property: 20, + property: 22, lower: lower, upper: upper, caseSensitive: caseSensitive, @@ -3423,7 +3861,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( StartsWithCondition( - property: 20, + property: 22, value: value, caseSensitive: caseSensitive, ), @@ -3438,7 +3876,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( EndsWithCondition( - property: 20, + property: 22, value: value, caseSensitive: caseSensitive, ), @@ -3453,7 +3891,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( ContainsCondition( - property: 20, + property: 22, value: value, caseSensitive: caseSensitive, ), @@ -3468,7 +3906,7 @@ extension DiaryQueryFilter on QueryBuilder { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( MatchesCondition( - property: 20, + property: 22, wildcard: pattern, caseSensitive: caseSensitive, ), @@ -3479,7 +3917,7 @@ extension DiaryQueryFilter on QueryBuilder { QueryBuilder yMdIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - const EqualCondition(property: 20, value: ''), + const EqualCondition(property: 22, value: ''), ); }); } @@ -3487,7 +3925,7 @@ extension DiaryQueryFilter on QueryBuilder { QueryBuilder yMdIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition( - const GreaterCondition(property: 20, value: ''), + const GreaterCondition(property: 22, value: ''), ); }); } @@ -3628,7 +4066,7 @@ extension DiaryQuerySortBy on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addSortBy(16, caseSensitive: caseSensitive); + return query.addSortBy(18, caseSensitive: caseSensitive); }); } @@ -3636,31 +4074,31 @@ extension DiaryQuerySortBy on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addSortBy(16, sort: Sort.desc, caseSensitive: caseSensitive); + return query.addSortBy(18, sort: Sort.desc, caseSensitive: caseSensitive); }); } QueryBuilder sortByImageColor() { return QueryBuilder.apply(this, (query) { - return query.addSortBy(17); + return query.addSortBy(19); }); } QueryBuilder sortByImageColorDesc() { return QueryBuilder.apply(this, (query) { - return query.addSortBy(17, sort: Sort.desc); + return query.addSortBy(19, sort: Sort.desc); }); } QueryBuilder sortByAspect() { return QueryBuilder.apply(this, (query) { - return query.addSortBy(18); + return query.addSortBy(20); }); } QueryBuilder sortByAspectDesc() { return QueryBuilder.apply(this, (query) { - return query.addSortBy(18, sort: Sort.desc); + return query.addSortBy(20, sort: Sort.desc); }); } @@ -3680,7 +4118,7 @@ extension DiaryQuerySortBy on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addSortBy(19, caseSensitive: caseSensitive); + return query.addSortBy(21, caseSensitive: caseSensitive); }); } @@ -3688,7 +4126,7 @@ extension DiaryQuerySortBy on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addSortBy(19, sort: Sort.desc, caseSensitive: caseSensitive); + return query.addSortBy(21, sort: Sort.desc, caseSensitive: caseSensitive); }); } @@ -3696,7 +4134,7 @@ extension DiaryQuerySortBy on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addSortBy(20, caseSensitive: caseSensitive); + return query.addSortBy(22, caseSensitive: caseSensitive); }); } @@ -3704,7 +4142,7 @@ extension DiaryQuerySortBy on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addSortBy(20, sort: Sort.desc, caseSensitive: caseSensitive); + return query.addSortBy(22, sort: Sort.desc, caseSensitive: caseSensitive); }); } } @@ -3842,7 +4280,7 @@ extension DiaryQuerySortThenBy on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addSortBy(16, caseSensitive: caseSensitive); + return query.addSortBy(18, caseSensitive: caseSensitive); }); } @@ -3850,31 +4288,31 @@ extension DiaryQuerySortThenBy on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addSortBy(16, sort: Sort.desc, caseSensitive: caseSensitive); + return query.addSortBy(18, sort: Sort.desc, caseSensitive: caseSensitive); }); } QueryBuilder thenByImageColor() { return QueryBuilder.apply(this, (query) { - return query.addSortBy(17); + return query.addSortBy(19); }); } QueryBuilder thenByImageColorDesc() { return QueryBuilder.apply(this, (query) { - return query.addSortBy(17, sort: Sort.desc); + return query.addSortBy(19, sort: Sort.desc); }); } QueryBuilder thenByAspect() { return QueryBuilder.apply(this, (query) { - return query.addSortBy(18); + return query.addSortBy(20); }); } QueryBuilder thenByAspectDesc() { return QueryBuilder.apply(this, (query) { - return query.addSortBy(18, sort: Sort.desc); + return query.addSortBy(20, sort: Sort.desc); }); } @@ -3894,7 +4332,7 @@ extension DiaryQuerySortThenBy on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addSortBy(19, caseSensitive: caseSensitive); + return query.addSortBy(21, caseSensitive: caseSensitive); }); } @@ -3902,7 +4340,7 @@ extension DiaryQuerySortThenBy on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addSortBy(19, sort: Sort.desc, caseSensitive: caseSensitive); + return query.addSortBy(21, sort: Sort.desc, caseSensitive: caseSensitive); }); } @@ -3910,7 +4348,7 @@ extension DiaryQuerySortThenBy on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addSortBy(20, caseSensitive: caseSensitive); + return query.addSortBy(22, caseSensitive: caseSensitive); }); } @@ -3918,7 +4356,7 @@ extension DiaryQuerySortThenBy on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addSortBy(20, sort: Sort.desc, caseSensitive: caseSensitive); + return query.addSortBy(22, sort: Sort.desc, caseSensitive: caseSensitive); }); } } @@ -4024,23 +4462,35 @@ extension DiaryQueryWhereDistinct on QueryBuilder { }); } - QueryBuilder distinctByType({ - bool caseSensitive = true, - }) { + QueryBuilder distinctByKeywords() { return QueryBuilder.apply(this, (query) { - return query.addDistinctBy(16, caseSensitive: caseSensitive); + return query.addDistinctBy(16); }); } - QueryBuilder distinctByImageColor() { + QueryBuilder distinctByTokenizer() { return QueryBuilder.apply(this, (query) { return query.addDistinctBy(17); }); } + QueryBuilder distinctByType({ + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addDistinctBy(18, caseSensitive: caseSensitive); + }); + } + + QueryBuilder distinctByImageColor() { + return QueryBuilder.apply(this, (query) { + return query.addDistinctBy(19); + }); + } + QueryBuilder distinctByAspect() { return QueryBuilder.apply(this, (query) { - return query.addDistinctBy(18); + return query.addDistinctBy(20); }); } @@ -4048,7 +4498,7 @@ extension DiaryQueryWhereDistinct on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addDistinctBy(19, caseSensitive: caseSensitive); + return query.addDistinctBy(21, caseSensitive: caseSensitive); }); } @@ -4056,7 +4506,7 @@ extension DiaryQueryWhereDistinct on QueryBuilder { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { - return query.addDistinctBy(20, caseSensitive: caseSensitive); + return query.addDistinctBy(22, caseSensitive: caseSensitive); }); } } @@ -4152,24 +4602,36 @@ extension DiaryQueryProperty1 on QueryBuilder { }); } - QueryBuilder typeProperty() { + QueryBuilder, QAfterProperty> keywordsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(16); }); } - QueryBuilder imageColorProperty() { + QueryBuilder, QAfterProperty> tokenizerProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(17); }); } - QueryBuilder aspectProperty() { + QueryBuilder typeProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(18); }); } + QueryBuilder imageColorProperty() { + return QueryBuilder.apply(this, (query) { + return query.addProperty(19); + }); + } + + QueryBuilder aspectProperty() { + return QueryBuilder.apply(this, (query) { + return query.addProperty(20); + }); + } + QueryBuilder isarIdProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(0); @@ -4178,13 +4640,13 @@ extension DiaryQueryProperty1 on QueryBuilder { QueryBuilder yMProperty() { return QueryBuilder.apply(this, (query) { - return query.addProperty(19); + return query.addProperty(21); }); } QueryBuilder yMdProperty() { return QueryBuilder.apply(this, (query) { - return query.addProperty(20); + return query.addProperty(22); }); } } @@ -4280,24 +4742,36 @@ extension DiaryQueryProperty2 on QueryBuilder { }); } - QueryBuilder typeProperty() { + QueryBuilder), QAfterProperty> keywordsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(16); }); } - QueryBuilder imageColorProperty() { + QueryBuilder), QAfterProperty> tokenizerProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(17); }); } - QueryBuilder aspectProperty() { + QueryBuilder typeProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(18); }); } + QueryBuilder imageColorProperty() { + return QueryBuilder.apply(this, (query) { + return query.addProperty(19); + }); + } + + QueryBuilder aspectProperty() { + return QueryBuilder.apply(this, (query) { + return query.addProperty(20); + }); + } + QueryBuilder isarIdProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(0); @@ -4306,13 +4780,13 @@ extension DiaryQueryProperty2 on QueryBuilder { QueryBuilder yMProperty() { return QueryBuilder.apply(this, (query) { - return query.addProperty(19); + return query.addProperty(21); }); } QueryBuilder yMdProperty() { return QueryBuilder.apply(this, (query) { - return query.addProperty(20); + return query.addProperty(22); }); } } @@ -4409,24 +4883,36 @@ extension DiaryQueryProperty3 }); } - QueryBuilder typeProperty() { + QueryBuilder), QOperations> keywordsProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(16); }); } - QueryBuilder imageColorProperty() { + QueryBuilder), QOperations> tokenizerProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(17); }); } - QueryBuilder aspectProperty() { + QueryBuilder typeProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(18); }); } + QueryBuilder imageColorProperty() { + return QueryBuilder.apply(this, (query) { + return query.addProperty(19); + }); + } + + QueryBuilder aspectProperty() { + return QueryBuilder.apply(this, (query) { + return query.addProperty(20); + }); + } + QueryBuilder isarIdProperty() { return QueryBuilder.apply(this, (query) { return query.addProperty(0); @@ -4435,13 +4921,13 @@ extension DiaryQueryProperty3 QueryBuilder yMProperty() { return QueryBuilder.apply(this, (query) { - return query.addProperty(19); + return query.addProperty(21); }); } QueryBuilder yMdProperty() { return QueryBuilder.apply(this, (query) { - return query.addProperty(20); + return query.addProperty(22); }); } } diff --git a/lib/components/base/image.dart b/lib/components/base/image.dart index 533e9fe..6e4d4e2 100644 --- a/lib/components/base/image.dart +++ b/lib/components/base/image.dart @@ -4,7 +4,6 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:moodiary/utils/cache_util.dart'; -import 'package:moodiary/utils/log_util.dart'; final kTransparentImage = Uint8List.fromList([ 0x89, @@ -149,7 +148,7 @@ class _MoodiaryImageState extends State { void _loadImage() async { _loadState.value = _ImageLoadState.loading; try { - logger.d('Image loaded from path: ${widget.imagePath}'); + //logger.d('Image loaded from path: ${widget.imagePath}'); final imageAspect = await ImageCacheUtil().getImageAspectRatioWithCache( imagePath: widget.imagePath, ); diff --git a/lib/components/base/sheet.dart b/lib/components/base/sheet.dart index 033a99c..97c6633 100644 --- a/lib/components/base/sheet.dart +++ b/lib/components/base/sheet.dart @@ -17,7 +17,7 @@ class FloatingModal extends StatelessWidget { @override Widget build(BuildContext context) { - final padding = MediaQuery.viewPaddingOf(context); + final padding = MediaQuery.viewInsetsOf(context); final size = MediaQuery.sizeOf(context); final maxHeight = isScrollControlled @@ -26,12 +26,12 @@ class FloatingModal extends StatelessWidget { return Align( alignment: Alignment.bottomCenter, child: ConstrainedBox( - constraints: BoxConstraints(maxHeight: maxHeight, maxWidth: 640), + constraints: BoxConstraints(maxHeight: maxHeight+padding.bottom, maxWidth: 640), child: Padding( padding: EdgeInsets.only( left: 16, right: 16, - bottom: max(padding.bottom, 16), + bottom: max(padding.bottom + 16, 16), ), child: Material( color: context.theme.colorScheme.surfaceContainerHigh, diff --git a/lib/components/search_card/search_card_logic.dart b/lib/components/search_card/search_card_logic.dart deleted file mode 100644 index 2dcd717..0000000 --- a/lib/components/search_card/search_card_logic.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:get/get.dart'; -import 'package:moodiary/common/models/isar/diary.dart'; -import 'package:moodiary/pages/diary_details/diary_details_logic.dart'; -import 'package:moodiary/router/app_routes.dart'; - -import 'search_card_state.dart'; - -class SearchCardLogic extends GetxController { - final SearchCardState state = SearchCardState(); - - //选中卡片后跳转到详情页,直接携带Diary作为参数 - Future toDiaryPage(Diary diary) async { - Bind.lazyPut(() => DiaryDetailsLogic(), tag: diary.id); - await Get.toNamed(AppRoutes.diaryPage, arguments: [diary.clone(), false]); - } -} diff --git a/lib/components/search_card/search_card_state.dart b/lib/components/search_card/search_card_state.dart deleted file mode 100644 index 2d8306c..0000000 --- a/lib/components/search_card/search_card_state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class SearchCardState { - SearchCardState() { - ///Initialize variables - } -} diff --git a/lib/components/search_card/search_card_view.dart b/lib/components/search_card/search_card_view.dart index fdf274e..9842a8e 100644 --- a/lib/components/search_card/search_card_view.dart +++ b/lib/components/search_card/search_card_view.dart @@ -1,58 +1,123 @@ +import 'package:dartx/dartx.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:moodiary/common/models/isar/diary.dart'; import 'package:moodiary/common/values/border.dart'; +import 'package:moodiary/components/base/text.dart'; +import 'package:moodiary/pages/diary_details/diary_details_logic.dart'; +import 'package:moodiary/router/app_routes.dart'; +import 'package:substring_highlight/substring_highlight.dart'; -import 'search_card_logic.dart'; +String getHighlightedExcerpt( + String content, + List keywords, { + int contextLength = 50, +}) { + for (final word in keywords) { + final index = content.indexOf(word); + if (index != -1) { + final wordStart = index; + final wordEnd = index + word.length; + + int start = wordStart - contextLength; + int end = wordEnd + contextLength; + + if (start < 0) { + end += -start; + start = 0; + } + if (end > content.length) { + final overflow = end - content.length; + start = (start - overflow).clamp(0, content.length); + end = content.length; + } + + final snippet = content.substring(start, end); + + final hasHead = start > 0; + final hasTail = end < content.length; + + return "${hasHead ? '...' : ''}$snippet${hasTail ? '...' : ''}"; + } + } + + // 没有关键词命中,返回默认摘要 + final fallback = content.length > 200 ? content.substring(0, 200) : content; + return "${fallback.trimRight()}${content.length > 200 ? '...' : ''}"; +} class SearchCardComponent extends StatelessWidget { const SearchCardComponent({ super.key, required this.diary, - required this.index, + required this.queryList, }); + final List queryList; + final Diary diary; - final String index; @override Widget build(BuildContext context) { - final logic = Bind.find(tag: index); - - return GetBuilder( - tag: index, - assignId: true, - builder: (_) { - return InkWell( - onTap: () { - logic.toDiaryPage(diary); - }, - child: Container( - decoration: BoxDecoration( - color: context.theme.colorScheme.surfaceContainerHighest, - borderRadius: AppBorderRadius.smallBorderRadius, - ), - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - diary.contentText, - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - Text(diary.time.toString().split('.')[0]), - ], - ), - ), - ], - ), - ), + final contentText = getHighlightedExcerpt( + diary.contentText.removeLineBreaks(), + queryList, + ); + final title = diary.title.removeLineBreaks(); + return InkWell( + onTap: () async { + Bind.lazyPut(() => DiaryDetailsLogic(), tag: diary.id); + await Get.toNamed( + AppRoutes.diaryPage, + arguments: [diary.clone(), false], ); }, + child: Container( + decoration: BoxDecoration( + color: context.theme.colorScheme.surfaceContainerHighest, + borderRadius: AppBorderRadius.smallBorderRadius, + ), + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 4.0, + children: [ + if (title.isNotBlank) + SubstringHighlight( + text: title, + terms: queryList, + maxLines: 1, + overflow: TextOverflow.ellipsis, + textStyle: context.textTheme.titleMedium!.copyWith( + color: context.theme.colorScheme.onSurface, + ), + textStyleHighlight: context.textTheme.titleMedium! + .copyWith( + backgroundColor: context.theme.colorScheme.primary, + color: context.theme.colorScheme.onPrimary, + ), + ), + SubstringHighlight( + text: contentText, + terms: queryList, + textStyle: context.textTheme.bodyMedium!.copyWith( + color: context.theme.colorScheme.onSurface, + ), + textStyleHighlight: context.textTheme.bodyMedium!.copyWith( + backgroundColor: context.theme.colorScheme.primary, + color: context.theme.colorScheme.onPrimary, + ), + ), + Text(diary.time.toString().split('.')[0]), + ], + ), + ), + ], + ), + ), ); } } diff --git a/lib/components/search_sheet/search_sheet_logic.dart b/lib/components/search_sheet/search_sheet_logic.dart index 25c02fa..2cd21e7 100644 --- a/lib/components/search_sheet/search_sheet_logic.dart +++ b/lib/components/search_sheet/search_sheet_logic.dart @@ -1,6 +1,13 @@ +import 'dart:async'; + +import 'package:dartx/dartx.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:moodiary/common/values/keyboard_state.dart'; +import 'package:moodiary/components/keyboard_listener/keyboard_listener.dart'; import 'package:moodiary/persistence/isar.dart'; +import 'package:moodiary/src/rust/api/jieba.dart'; +import 'package:throttling/throttling.dart'; import 'search_sheet_state.dart'; @@ -9,27 +16,97 @@ class SearchSheetLogic extends GetxController { late TextEditingController textEditingController = TextEditingController(); late FocusNode focusNode = FocusNode(); + late final KeyboardObserver _keyboardObserver; + + late final Throttling _throttling = Throttling( + duration: const Duration(milliseconds: 500), + ); + + String _lastText = ''; + + Timer? _timer; + + @override + void onInit() { + _keyboardObserver = KeyboardObserver( + onHeightChanged: (height) { + if (height > 0) { + state.keyboardHeight.value = height; + } + }, + onStateChanged: (state) { + switch (state) { + case KeyboardState.opening: + break; + case KeyboardState.closing: + unFocus(); + break; + case KeyboardState.closed: + break; + case KeyboardState.unknown: + break; + } + }, + ); + _keyboardObserver.start(); + textEditingController.addListener(() { + _throttling.throttle(() async { + await doSearch(); + }); + }); + + _timer = Timer.periodic(const Duration(milliseconds: 500), (_) async { + final currentText = textEditingController.text.trim(); + if (currentText != _lastText) { + _lastText = currentText; + if (currentText.isNotBlank) { + await doSearch(); + } else { + clear(); + } + } + }); + super.onInit(); + } + @override void onClose() { + _keyboardObserver.stop(); textEditingController.dispose(); focusNode.dispose(); + _throttling.close(); + _timer?.cancel(); + _timer = null; super.onClose(); } - void clearSearch() { - state.searchList = []; + void unFocus() { + focusNode.unfocus(); + } + + void clear() { + state.searchList.clear(); + state.totalCount.value = 0; + state.queryList = []; + state.isSearching.value = false; update(); } - Future search() async { - focusNode.unfocus(); - if (textEditingController.text != '') { - state.isSearching.value = true; - state.searchList = await IsarUtil.searchDiaries( - textEditingController.text, - ); - state.totalCount.value = state.searchList.length; - state.isSearching.value = false; + Future doSearch() async { + final currentText = textEditingController.text.trim(); + if (currentText == _lastText) { + return; } + if (currentText.isBlank) { + clear(); + return; + } + state.isSearching.value = true; + _lastText = currentText; + final queryList = await JiebaRs.cutForSearch(text: _lastText, hmm: true); + state.searchList = await IsarUtil.searchDiaries(queryList: queryList); + state.totalCount.value = state.searchList.length; + state.queryList = queryList; + state.isSearching.value = false; } } diff --git a/lib/components/search_sheet/search_sheet_state.dart b/lib/components/search_sheet/search_sheet_state.dart index d57a482..c7c5109 100644 --- a/lib/components/search_sheet/search_sheet_state.dart +++ b/lib/components/search_sheet/search_sheet_state.dart @@ -9,6 +9,10 @@ class SearchSheetState { late RxInt totalCount; + RxDouble keyboardHeight = 0.0.obs; + + late List queryList = []; + SearchSheetState() { searchList = []; isSearching = false.obs; diff --git a/lib/components/search_sheet/search_sheet_view.dart b/lib/components/search_sheet/search_sheet_view.dart index 9d26e35..2cdafad 100644 --- a/lib/components/search_sheet/search_sheet_view.dart +++ b/lib/components/search_sheet/search_sheet_view.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:gap/gap.dart'; import 'package:get/get.dart'; import 'package:moodiary/common/values/border.dart'; -import 'package:moodiary/components/search_card/search_card_logic.dart'; import 'package:moodiary/components/search_card/search_card_view.dart'; import 'package:moodiary/l10n/l10n.dart'; @@ -21,12 +22,7 @@ class SearchSheetComponent extends StatelessWidget { return Column( children: [ Padding( - padding: const EdgeInsets.only( - left: 8.0, - right: 8.0, - top: 8.0, - bottom: 4.0, - ), + padding: const EdgeInsets.all(8.0), child: TextField( maxLines: 1, controller: logic.textEditingController, @@ -40,8 +36,8 @@ class SearchSheetComponent extends StatelessWidget { filled: true, labelText: context.l10n.diarySearch, suffixIcon: IconButton( - onPressed: () { - logic.search(); + onPressed: () async { + await logic.doSearch(); }, icon: const Icon(Icons.search), ), @@ -49,32 +45,57 @@ class SearchSheetComponent extends StatelessWidget { ), ), Obx(() { - return Expanded( - child: - state.isSearching.value - ? const Center(child: CircularProgressIndicator()) - : ListView.builder( - itemCount: state.searchList.length, - padding: EdgeInsets.zero, - itemBuilder: (context, index) { - Bind.lazyPut( - () => SearchCardLogic(), - tag: index.toString(), - ); - return Padding( - padding: const EdgeInsets.only( - left: 8.0, - right: 8.0, - top: 4.0, - bottom: 4.0, - ), - child: SearchCardComponent( - diary: state.searchList[index], - index: index.toString(), - ), - ); - }, + Widget child; + if (state.isSearching.value && state.searchList.isEmpty) { + child = const Center( + key: ValueKey('loading'), + child: CircularProgressIndicator(), + ); + } else if (state.searchList.isEmpty) { + child = Center( + key: const ValueKey('empty'), + child: FaIcon( + FontAwesomeIcons.boxOpen, + color: context.theme.colorScheme.onSurface, + size: 56, + ), + ); + } else { + child = Stack( + children: [ + Positioned.fill( + child: ListView.separated( + itemCount: state.searchList.length, + padding: const EdgeInsets.symmetric(horizontal: 8.0), + itemBuilder: (context, index) { + return SearchCardComponent( + diary: state.searchList[index], + queryList: state.queryList, + ); + }, + separatorBuilder: (_, _) => const Gap(8.0), + ), + ), + if (state.isSearching.value && state.searchList.isNotEmpty) + Positioned.fill( + child: Container( + color: context.theme.colorScheme.surfaceContainer + .withValues(alpha: 0.8), + child: const Center( + key: ValueKey('loading2'), + child: CircularProgressIndicator(), + ), ), + ), + ], + ); + } + + return Expanded( + child: AnimatedSwitcher( + duration: Durations.short3, + child: child, + ), ); }), Padding( diff --git a/lib/pages/edit/edit_logic.dart b/lib/pages/edit/edit_logic.dart index 21a40ed..2edda62 100644 --- a/lib/pages/edit/edit_logic.dart +++ b/lib/pages/edit/edit_logic.dart @@ -13,6 +13,7 @@ import 'package:moodiary/api/api.dart'; import 'package:moodiary/common/models/isar/diary.dart'; import 'package:moodiary/common/values/diary_type.dart'; import 'package:moodiary/common/values/keyboard_state.dart'; +import 'package:moodiary/components/base/text.dart'; import 'package:moodiary/components/keyboard_listener/keyboard_listener.dart'; import 'package:moodiary/components/quill_embed/audio_embed.dart'; import 'package:moodiary/components/quill_embed/image_embed.dart'; @@ -22,6 +23,7 @@ import 'package:moodiary/l10n/l10n.dart'; import 'package:moodiary/persistence/isar.dart'; import 'package:moodiary/persistence/pref.dart'; import 'package:moodiary/router/app_routes.dart'; +import 'package:moodiary/src/rust/api/jieba.dart'; import 'package:moodiary/src/rust/api/kmp.dart'; import 'package:moodiary/utils/file_util.dart'; import 'package:moodiary/utils/markdown_util.dart'; @@ -435,14 +437,25 @@ class EditLogic extends GetxController { text: originContent, replacements: {...imageNameMap, ...videoNameMap, ...audioNameMap}, ); + final contentText = _toPlainText().removeLineBreaks(); + final tokenizer = await JiebaRs.cutAll(text: contentText); + final keywords = await JiebaRs.extractKeywordsTfidf( + text: contentText, + topK: BigInt.from(5), + allowedPos: [], + ); + final sortByWeight = keywords..sort((a, b) => b.weight.compareTo(a.weight)); + final sortedKeywords = sortByWeight.map((e) => e.keyword).toList(); state.currentDiary ..title = titleTextEditingController.text ..content = content ..type = state.type.value - ..contentText = _toPlainText() + ..contentText = contentText ..audioName = state.audioNameList ..imageName = imageNameMap.values.toList() ..videoName = videoNameMap.values.toList() + ..tokenizer = tokenizer + ..keywords = sortedKeywords ..imageColor = await getCoverColor() ..aspect = await getCoverAspect(); diff --git a/lib/pages/laboratory/laboratory_logic.dart b/lib/pages/laboratory/laboratory_logic.dart index 6a4313e..91a04ac 100644 --- a/lib/pages/laboratory/laboratory_logic.dart +++ b/lib/pages/laboratory/laboratory_logic.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:io'; import 'package:get/get.dart'; +import 'package:moodiary/persistence/isar.dart'; import 'package:moodiary/persistence/pref.dart'; import 'package:moodiary/utils/aes_util.dart'; import 'package:moodiary/utils/cache_util.dart'; @@ -85,4 +86,13 @@ class LaboratoryLogic extends GetxController { return false; } } + + bool generateFTSAndKeyword() { + try { + IsarUtil.mergeToV2_7_4(FileUtil.getRealPath('database', '')); + return true; + } catch (e) { + return false; + } + } } diff --git a/lib/pages/laboratory/laboratory_view.dart b/lib/pages/laboratory/laboratory_view.dart index 1a10535..d262245 100644 --- a/lib/pages/laboratory/laboratory_view.dart +++ b/lib/pages/laboratory/laboratory_view.dart @@ -108,6 +108,18 @@ class LaboratoryPage extends StatelessWidget { }, title: const Text('清理图片缩略图缓存'), ), + const Gap(12), + ListTile( + onTap: () async { + final res = logic.generateFTSAndKeyword(); + if (res) { + toast.success(message: '重新生成成功'); + } else { + toast.error(message: '重新生成失败'); + } + }, + title: const Text('重新进行全文搜索索引'), + ), ], ); }, diff --git a/lib/persistence/isar.dart b/lib/persistence/isar.dart index 0748dbc..b9f5da6 100644 --- a/lib/persistence/isar.dart +++ b/lib/persistence/isar.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:collection'; import 'dart:convert'; import 'package:flutter/material.dart'; @@ -11,10 +12,12 @@ import 'package:moodiary/common/models/isar/font.dart'; import 'package:moodiary/common/models/isar/sync_record.dart'; import 'package:moodiary/common/models/map.dart'; import 'package:moodiary/common/values/diary_type.dart'; +import 'package:moodiary/components/base/text.dart'; import 'package:moodiary/components/quill_embed/audio_embed.dart'; import 'package:moodiary/components/quill_embed/image_embed.dart'; import 'package:moodiary/components/quill_embed/video_embed.dart'; import 'package:moodiary/persistence/pref.dart'; +import 'package:moodiary/src/rust/api/jieba.dart'; import 'package:moodiary/utils/file_util.dart'; import 'package:moodiary/utils/webdav_util.dart'; import 'package:path/path.dart'; @@ -201,28 +204,38 @@ class IsarUtil { } } - //查询日记 - static Future> searchDiaries(String value) async { - final contentResults = - await _isar.diarys - .where() - .showEqualTo(true) - .contentTextContains(value) - .findAllAsync(); - final titleResults = - await _isar.diarys - .where() - .showEqualTo(true) - .titleContains(value) - .findAllAsync(); + static Future> searchDiaries({ + required List queryList, + }) async { + if (queryList.isEmpty) return []; - // 合并并去重 - final combinedResults = {...contentResults, ...titleResults}.toList(); + // 收集所有匹配关键词的内容结果 + final HashSet results = HashSet( + equals: (a, b) { + return a.isarId == b.isarId; + }, + hashCode: (e) { + return e.isarId; + }, + ); - // 按时间排序 - combinedResults.sort((a, b) => b.time.compareTo(a.time)); + for (final word in queryList) { + final matches = + await _isar.diarys + .where() + .showEqualTo(true) + .tokenizerElementMatches(word, caseSensitive: false) + .or() + .titleContains(word, caseSensitive: false) + .findAllAsync(); + results.addAll(matches); + } - return combinedResults; + // 按时间降序排序 + final List sortedResults = + results.toList()..sort((a, b) => b.time.compareTo(a.time)); + + return sortedResults; } static Future> searchDiariesByTag(String value) async { @@ -435,6 +448,37 @@ class IsarUtil { isar.close(); } + /// 2.7.4 版本变更 + /// 新增字段 + /// 1. keywords 关键词 + /// 2. tokenizer 分词器 + static Future mergeToV2_7_4(String dir) async { + final countDiary = _isar.diarys.where().count(); + for (var i = 0; i < countDiary; i += 50) { + final diaries = await _isar.diarys.where().findAllAsync( + offset: i, + limit: 50, + ); + for (final diary in diaries) { + final newContent = diary.contentText.removeLineBreaks(); + diary.tokenizer = await JiebaRs.cutAll(text: newContent); + final keywords = await JiebaRs.extractKeywordsTfidf( + text: newContent, + topK: BigInt.from(5), + allowedPos: [], + ); + final sortByWeight = + keywords..sort((a, b) => b.weight.compareTo(a.weight)); + final sortedKeywords = sortByWeight.map((e) => e.keyword).toList(); + diary.keywords = sortedKeywords; + diary.contentText = newContent; + await _isar.writeAsync((isar) { + isar.diarys.put(diary); + }); + } + } + } + /// 2.6.3 修复 /// 修复之前webdav同步时,没有同步分类的问题 /// 遍历所有日记,如果本地没有日记的分类,就创建一个分类,名称为分类名 diff --git a/lib/src/rust/api/aes.dart b/lib/src/rust/api/aes.dart index 64d6ae4..9071007 100644 --- a/lib/src/rust/api/aes.dart +++ b/lib/src/rust/api/aes.dart @@ -3,9 +3,8 @@ // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - import '../frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; // Rust type: RustOpaqueMoi> abstract class AesEncryption implements RustOpaqueInterface { diff --git a/lib/src/rust/api/compress.dart b/lib/src/rust/api/compress.dart index 559d23c..0820fe7 100644 --- a/lib/src/rust/api/compress.dart +++ b/lib/src/rust/api/compress.dart @@ -3,31 +3,13 @@ // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - import '../frb_generated.dart'; import 'constants.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; -// These functions are ignored because they are not marked as `pub`: `calculate_target_dimensions`, `load_image` +// These functions are ignored because they are not marked as `pub`: `calculate_target_dimensions`, `compress` // These types are ignored because they are neither used by any `pub` functions nor (for structs and enums) marked `#[frb(unignore)]`: `ResizeOptions` -Future compress({ - required DynamicImage img, - required int dstHeight, - required int dstWidth, - required CompressFormat compressFormat, - required int quality, -}) => RustLib.instance.api.crateApiCompressCompress( - img: img, - dstHeight: dstHeight, - dstWidth: dstWidth, - compressFormat: compressFormat, - quality: quality, -); - -// Rust type: RustOpaqueMoi> -abstract class DynamicImage implements RustOpaqueInterface {} - // Rust type: RustOpaqueMoi> abstract class ImageCompress implements RustOpaqueInterface { static Future containWithOptions({ diff --git a/lib/src/rust/api/constants.dart b/lib/src/rust/api/constants.dart index 40fc11c..1459b8e 100644 --- a/lib/src/rust/api/constants.dart +++ b/lib/src/rust/api/constants.dart @@ -3,9 +3,8 @@ // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - import '../frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; // These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `assert_receiver_is_total_eq`, `eq` diff --git a/lib/src/rust/api/font.dart b/lib/src/rust/api/font.dart index 1bec250..6dbe881 100644 --- a/lib/src/rust/api/font.dart +++ b/lib/src/rust/api/font.dart @@ -3,9 +3,8 @@ // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - import '../frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; // Rust type: RustOpaqueMoi> abstract class FontReader implements RustOpaqueInterface { diff --git a/lib/src/rust/api/jieba.dart b/lib/src/rust/api/jieba.dart new file mode 100644 index 0000000..4988a4a --- /dev/null +++ b/lib/src/rust/api/jieba.dart @@ -0,0 +1,58 @@ +// This file is automatically generated, so please do not edit it. +// @generated by `flutter_rust_bridge`@ 2.9.0. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; + +// These functions are ignored because they are not marked as `pub`: `convert_keywords`, `get_instance`, `init_global`, `new` +// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `fmt` + +// Rust type: RustOpaqueMoi> +abstract class JiebaRs implements RustOpaqueInterface { + static Future> cut({required String text, required bool hmm}) => + RustLib.instance.api.crateApiJiebaJiebaRsCut(text: text, hmm: hmm); + + static Future> cutAll({required String text}) => + RustLib.instance.api.crateApiJiebaJiebaRsCutAll(text: text); + + static Future> cutForSearch({ + required String text, + required bool hmm, + }) => RustLib.instance.api.crateApiJiebaJiebaRsCutForSearch( + text: text, + hmm: hmm, + ); + + static Future> extractKeywordsTextRank({ + required String text, + required BigInt topK, + required List allowedPos, + }) => RustLib.instance.api.crateApiJiebaJiebaRsExtractKeywordsTextRank( + text: text, + topK: topK, + allowedPos: allowedPos, + ); + + static Future> extractKeywordsTfidf({ + required String text, + required BigInt topK, + required List allowedPos, + }) => RustLib.instance.api.crateApiJiebaJiebaRsExtractKeywordsTfidf( + text: text, + topK: topK, + allowedPos: allowedPos, + ); +} + +// Rust type: RustOpaqueMoi> +abstract class Keyword implements RustOpaqueInterface { + String get keyword; + + double get weight; + + set keyword(String keyword); + + set weight(double weight); +} diff --git a/lib/src/rust/api/kmp.dart b/lib/src/rust/api/kmp.dart index 050292c..e63bfa9 100644 --- a/lib/src/rust/api/kmp.dart +++ b/lib/src/rust/api/kmp.dart @@ -3,9 +3,8 @@ // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - import '../frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; Future buildPrefixTable({required List pattern}) => RustLib.instance.api.crateApiKmpBuildPrefixTable(pattern: pattern); diff --git a/lib/src/rust/api/zip.dart b/lib/src/rust/api/zip.dart index 504faca..41e61ca 100644 --- a/lib/src/rust/api/zip.dart +++ b/lib/src/rust/api/zip.dart @@ -3,9 +3,8 @@ // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - import '../frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; // These functions are ignored because they are not marked as `pub`: `read_file_to_vec` diff --git a/lib/src/rust/frb_generated.dart b/lib/src/rust/frb_generated.dart index 1f73666..f856cc3 100644 --- a/lib/src/rust/frb_generated.dart +++ b/lib/src/rust/frb_generated.dart @@ -3,20 +3,19 @@ // ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field -import 'dart:async'; -import 'dart:convert'; - -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - import 'api/aes.dart'; import 'api/compress.dart'; import 'api/constants.dart'; import 'api/font.dart'; +import 'api/jieba.dart'; import 'api/kmp.dart'; import 'api/zip.dart'; +import 'dart:async'; +import 'dart:convert'; import 'frb_generated.dart'; import 'frb_generated.io.dart' -if (dart.library.js_interop) 'frb_generated.webated.dart'; + if (dart.library.js_interop) 'frb_generated.web.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; /// Main entrypoint of the Rust API class RustLib extends BaseEntrypoint { @@ -59,7 +58,9 @@ class RustLib extends BaseEntrypoint { RustLibWire.fromExternalLibrary; @override - Future executeRustInitializers() async {} + Future executeRustInitializers() async { + await api.crateApiJiebaInitJieba(); + } @override ExternalLibraryLoaderConfig get defaultExternalLibraryLoaderConfig => @@ -69,7 +70,7 @@ class RustLib extends BaseEntrypoint { String get codegenVersion => '2.9.0'; @override - int get rustContentHash => 199828844; + int get rustContentHash => 1525123801; static const kDefaultExternalLibraryLoaderConfig = ExternalLibraryLoaderConfig( @@ -115,6 +116,44 @@ abstract class RustLibApi extends BaseApi { int? quality, }); + Future> crateApiJiebaJiebaRsCut({ + required String text, + required bool hmm, + }); + + Future> crateApiJiebaJiebaRsCutAll({required String text}); + + Future> crateApiJiebaJiebaRsCutForSearch({ + required String text, + required bool hmm, + }); + + Future> crateApiJiebaJiebaRsExtractKeywordsTextRank({ + required String text, + required BigInt topK, + required List allowedPos, + }); + + Future> crateApiJiebaJiebaRsExtractKeywordsTfidf({ + required String text, + required BigInt topK, + required List allowedPos, + }); + + String crateApiJiebaKeywordAutoAccessorGetKeyword({required Keyword that}); + + double crateApiJiebaKeywordAutoAccessorGetWeight({required Keyword that}); + + void crateApiJiebaKeywordAutoAccessorSetKeyword({ + required Keyword that, + required String keyword, + }); + + void crateApiJiebaKeywordAutoAccessorSetWeight({ + required Keyword that, + required double weight, + }); + Future> crateApiKmpKmpFindMatches({ required String text, required List patterns, @@ -153,13 +192,7 @@ abstract class RustLibApi extends BaseApi { required List pattern, }); - Future crateApiCompressCompress({ - required DynamicImage img, - required int dstHeight, - required int dstWidth, - required CompressFormat compressFormat, - required int quality, - }); + Future crateApiJiebaInitJieba(); Future crateApiKmpKmpSearch({ required String text, @@ -175,14 +208,6 @@ abstract class RustLibApi extends BaseApi { CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_AesEncryptionPtr; - RustArcIncrementStrongCountFnType - get rust_arc_increment_strong_count_DynamicImage; - - RustArcDecrementStrongCountFnType - get rust_arc_decrement_strong_count_DynamicImage; - - CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_DynamicImagePtr; - RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_FontReader; @@ -200,6 +225,18 @@ abstract class RustLibApi extends BaseApi { CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ImageCompressPtr; + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_JiebaRs; + + RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_JiebaRs; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_JiebaRsPtr; + + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Keyword; + + RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Keyword; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_KeywordPtr; + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Kmp; RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Kmp; @@ -464,6 +501,301 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ], ); + @override + Future> crateApiJiebaJiebaRsCut({ + required String text, + required bool hmm, + }) { + return handler.executeNormal( + NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(text, serializer); + sse_encode_bool(hmm, serializer); + pdeCallFfi( + generalizedFrbRustBinding, + serializer, + funcId: 7, + port: port_, + ); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_list_String, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiJiebaJiebaRsCutConstMeta, + argValues: [text, hmm], + apiImpl: this, + ), + ); + } + + TaskConstMeta get kCrateApiJiebaJiebaRsCutConstMeta => + const TaskConstMeta(debugName: "JiebaRs_cut", argNames: ["text", "hmm"]); + + @override + Future> crateApiJiebaJiebaRsCutAll({required String text}) { + return handler.executeNormal( + NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(text, serializer); + pdeCallFfi( + generalizedFrbRustBinding, + serializer, + funcId: 8, + port: port_, + ); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_list_String, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiJiebaJiebaRsCutAllConstMeta, + argValues: [text], + apiImpl: this, + ), + ); + } + + TaskConstMeta get kCrateApiJiebaJiebaRsCutAllConstMeta => + const TaskConstMeta(debugName: "JiebaRs_cut_all", argNames: ["text"]); + + @override + Future> crateApiJiebaJiebaRsCutForSearch({ + required String text, + required bool hmm, + }) { + return handler.executeNormal( + NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(text, serializer); + sse_encode_bool(hmm, serializer); + pdeCallFfi( + generalizedFrbRustBinding, + serializer, + funcId: 9, + port: port_, + ); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_list_String, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiJiebaJiebaRsCutForSearchConstMeta, + argValues: [text, hmm], + apiImpl: this, + ), + ); + } + + TaskConstMeta get kCrateApiJiebaJiebaRsCutForSearchConstMeta => + const TaskConstMeta( + debugName: "JiebaRs_cut_for_search", + argNames: ["text", "hmm"], + ); + + @override + Future> crateApiJiebaJiebaRsExtractKeywordsTextRank({ + required String text, + required BigInt topK, + required List allowedPos, + }) { + return handler.executeNormal( + NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(text, serializer); + sse_encode_usize(topK, serializer); + sse_encode_list_String(allowedPos, serializer); + pdeCallFfi( + generalizedFrbRustBinding, + serializer, + funcId: 10, + port: port_, + ); + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_list_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiJiebaJiebaRsExtractKeywordsTextRankConstMeta, + argValues: [text, topK, allowedPos], + apiImpl: this, + ), + ); + } + + TaskConstMeta get kCrateApiJiebaJiebaRsExtractKeywordsTextRankConstMeta => + const TaskConstMeta( + debugName: "JiebaRs_extract_keywords_text_rank", + argNames: ["text", "topK", "allowedPos"], + ); + + @override + Future> crateApiJiebaJiebaRsExtractKeywordsTfidf({ + required String text, + required BigInt topK, + required List allowedPos, + }) { + return handler.executeNormal( + NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(text, serializer); + sse_encode_usize(topK, serializer); + sse_encode_list_String(allowedPos, serializer); + pdeCallFfi( + generalizedFrbRustBinding, + serializer, + funcId: 11, + port: port_, + ); + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_list_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiJiebaJiebaRsExtractKeywordsTfidfConstMeta, + argValues: [text, topK, allowedPos], + apiImpl: this, + ), + ); + } + + TaskConstMeta get kCrateApiJiebaJiebaRsExtractKeywordsTfidfConstMeta => + const TaskConstMeta( + debugName: "JiebaRs_extract_keywords_tfidf", + argNames: ["text", "topK", "allowedPos"], + ); + + @override + String crateApiJiebaKeywordAutoAccessorGetKeyword({required Keyword that}) { + return handler.executeSync( + SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + that, + serializer, + ); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 12)!; + }, + codec: SseCodec( + decodeSuccessData: sse_decode_String, + decodeErrorData: null, + ), + constMeta: kCrateApiJiebaKeywordAutoAccessorGetKeywordConstMeta, + argValues: [that], + apiImpl: this, + ), + ); + } + + TaskConstMeta get kCrateApiJiebaKeywordAutoAccessorGetKeywordConstMeta => + const TaskConstMeta( + debugName: "Keyword_auto_accessor_get_keyword", + argNames: ["that"], + ); + + @override + double crateApiJiebaKeywordAutoAccessorGetWeight({required Keyword that}) { + return handler.executeSync( + SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + that, + serializer, + ); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 13)!; + }, + codec: SseCodec( + decodeSuccessData: sse_decode_f_64, + decodeErrorData: null, + ), + constMeta: kCrateApiJiebaKeywordAutoAccessorGetWeightConstMeta, + argValues: [that], + apiImpl: this, + ), + ); + } + + TaskConstMeta get kCrateApiJiebaKeywordAutoAccessorGetWeightConstMeta => + const TaskConstMeta( + debugName: "Keyword_auto_accessor_get_weight", + argNames: ["that"], + ); + + @override + void crateApiJiebaKeywordAutoAccessorSetKeyword({ + required Keyword that, + required String keyword, + }) { + return handler.executeSync( + SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + that, + serializer, + ); + sse_encode_String(keyword, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 14)!; + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: null, + ), + constMeta: kCrateApiJiebaKeywordAutoAccessorSetKeywordConstMeta, + argValues: [that, keyword], + apiImpl: this, + ), + ); + } + + TaskConstMeta get kCrateApiJiebaKeywordAutoAccessorSetKeywordConstMeta => + const TaskConstMeta( + debugName: "Keyword_auto_accessor_set_keyword", + argNames: ["that", "keyword"], + ); + + @override + void crateApiJiebaKeywordAutoAccessorSetWeight({ + required Keyword that, + required double weight, + }) { + return handler.executeSync( + SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + that, + serializer, + ); + sse_encode_f_64(weight, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 15)!; + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: null, + ), + constMeta: kCrateApiJiebaKeywordAutoAccessorSetWeightConstMeta, + argValues: [that, weight], + apiImpl: this, + ), + ); + } + + TaskConstMeta get kCrateApiJiebaKeywordAutoAccessorSetWeightConstMeta => + const TaskConstMeta( + debugName: "Keyword_auto_accessor_set_weight", + argNames: ["that", "weight"], + ); + @override Future> crateApiKmpKmpFindMatches({ required String text, @@ -478,7 +810,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 7, + funcId: 16, port: port_, ); }, @@ -512,7 +844,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 8, + funcId: 17, port: port_, ); }, @@ -554,7 +886,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 9, + funcId: 18, port: port_, ); }, @@ -595,7 +927,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 10, + funcId: 19, port: port_, ); }, @@ -631,7 +963,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 11, + funcId: 20, port: port_, ); }, @@ -664,7 +996,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 12, + funcId: 21, port: port_, ); }, @@ -689,7 +1021,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { callFfi: () { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_String(filePath, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 13)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 22)!; }, codec: SseCodec( decodeSuccessData: @@ -718,7 +1050,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 14, + funcId: 23, port: port_, ); }, @@ -740,47 +1072,31 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ); @override - Future crateApiCompressCompress({ - required DynamicImage img, - required int dstHeight, - required int dstWidth, - required CompressFormat compressFormat, - required int quality, - }) { + Future crateApiJiebaInitJieba() { return handler.executeNormal( NormalTask( callFfi: (port_) { final serializer = SseSerializer(generalizedFrbRustBinding); - sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - img, - serializer, - ); - sse_encode_u_32(dstHeight, serializer); - sse_encode_u_32(dstWidth, serializer); - sse_encode_compress_format(compressFormat, serializer); - sse_encode_u_8(quality, serializer); pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 15, + funcId: 24, port: port_, ); }, codec: SseCodec( - decodeSuccessData: sse_decode_list_prim_u_8_strict, - decodeErrorData: sse_decode_AnyhowException, + decodeSuccessData: sse_decode_unit, + decodeErrorData: null, ), - constMeta: kCrateApiCompressCompressConstMeta, - argValues: [img, dstHeight, dstWidth, compressFormat, quality], + constMeta: kCrateApiJiebaInitJiebaConstMeta, + argValues: [], apiImpl: this, ), ); } - TaskConstMeta get kCrateApiCompressCompressConstMeta => const TaskConstMeta( - debugName: "compress", - argNames: ["img", "dstHeight", "dstWidth", "compressFormat", "quality"], - ); + TaskConstMeta get kCrateApiJiebaInitJiebaConstMeta => + const TaskConstMeta(debugName: "init_jieba", argNames: []); @override Future crateApiKmpKmpSearch({ @@ -796,7 +1112,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 16, + funcId: 25, port: port_, ); }, @@ -824,14 +1140,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { get rust_arc_decrement_strong_count_AesEncryption => wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption; - RustArcIncrementStrongCountFnType - get rust_arc_increment_strong_count_DynamicImage => - wire.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage; - - RustArcDecrementStrongCountFnType - get rust_arc_decrement_strong_count_DynamicImage => - wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage; - RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_FontReader => wire.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader; @@ -848,6 +1156,22 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { get rust_arc_decrement_strong_count_ImageCompress => wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress; + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_JiebaRs => + wire.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_JiebaRs => + wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_Keyword => + wire.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_Keyword => + wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword; + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Kmp => wire.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp; @@ -893,6 +1217,24 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return ImageCompressImpl.frbInternalDcoDecode(raw as List); } + @protected + JiebaRs + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + dynamic raw, + ) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return JiebaRsImpl.frbInternalDcoDecode(raw as List); + } + + @protected + Keyword + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + dynamic raw, + ) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return KeywordImpl.frbInternalDcoDecode(raw as List); + } + @protected Kmp dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( @@ -911,6 +1253,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return ZipImpl.frbInternalDcoDecode(raw as List); } + @protected + Keyword + dco_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + dynamic raw, + ) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return KeywordImpl.frbInternalDcoDecode(raw as List); + } + @protected Zip dco_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( @@ -921,12 +1272,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } @protected - DynamicImage - dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( + Keyword + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( dynamic raw, ) { // Codec=Dco (DartCObject based), see doc to use other codecs - return DynamicImageImpl.frbInternalDcoDecode(raw as List); + return KeywordImpl.frbInternalDcoDecode(raw as List); } @protected @@ -962,15 +1313,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return AesEncryptionImpl.frbInternalDcoDecode(raw as List); } - @protected - DynamicImage - dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - dynamic raw, - ) { - // Codec=Dco (DartCObject based), see doc to use other codecs - return DynamicImageImpl.frbInternalDcoDecode(raw as List); - } - @protected FontReader dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( @@ -989,6 +1331,24 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return ImageCompressImpl.frbInternalDcoDecode(raw as List); } + @protected + JiebaRs + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + dynamic raw, + ) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return JiebaRsImpl.frbInternalDcoDecode(raw as List); + } + + @protected + Keyword + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + dynamic raw, + ) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return KeywordImpl.frbInternalDcoDecode(raw as List); + } + @protected Kmp dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( @@ -1013,6 +1373,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw as String; } + @protected + bool dco_decode_bool(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as bool; + } + @protected CompressFormat dco_decode_box_autoadd_compress_format(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1043,12 +1409,31 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw as double; } + @protected + double dco_decode_f_64(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as double; + } + @protected int dco_decode_i_32(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs return raw as int; } + @protected + List + dco_decode_list_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + dynamic raw, + ) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List) + .map( + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword, + ) + .toList(); + } + @protected List dco_decode_list_Char(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1202,6 +1587,30 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ); } + @protected + JiebaRs + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + SseDeserializer deserializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + return JiebaRsImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), + sse_decode_i_32(deserializer), + ); + } + + @protected + Keyword + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + SseDeserializer deserializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + return KeywordImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), + sse_decode_i_32(deserializer), + ); + } + @protected Kmp sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( @@ -1226,6 +1635,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ); } + @protected + Keyword + sse_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + SseDeserializer deserializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + return KeywordImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), + sse_decode_i_32(deserializer), + ); + } + @protected Zip sse_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( @@ -1239,12 +1660,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } @protected - DynamicImage - sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( + Keyword + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( SseDeserializer deserializer, ) { // Codec=Sse (Serialization based), see doc to use other codecs - return DynamicImageImpl.frbInternalSseDecode( + return KeywordImpl.frbInternalSseDecode( sse_decode_usize(deserializer), sse_decode_i_32(deserializer), ); @@ -1287,18 +1708,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ); } - @protected - DynamicImage - sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - SseDeserializer deserializer, - ) { - // Codec=Sse (Serialization based), see doc to use other codecs - return DynamicImageImpl.frbInternalSseDecode( - sse_decode_usize(deserializer), - sse_decode_i_32(deserializer), - ); - } - @protected FontReader sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( @@ -1323,6 +1732,30 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ); } + @protected + JiebaRs + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + SseDeserializer deserializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + return JiebaRsImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), + sse_decode_i_32(deserializer), + ); + } + + @protected + Keyword + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + SseDeserializer deserializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + return KeywordImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), + sse_decode_i_32(deserializer), + ); + } + @protected Kmp sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( @@ -1354,6 +1787,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return utf8.decoder.convert(inner); } + @protected + bool sse_decode_bool(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getUint8() != 0; + } + @protected CompressFormat sse_decode_box_autoadd_compress_format( SseDeserializer deserializer, @@ -1387,12 +1826,37 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return deserializer.buffer.getFloat32(); } + @protected + double sse_decode_f_64(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getFloat64(); + } + @protected int sse_decode_i_32(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs return deserializer.buffer.getInt32(); } + @protected + List + sse_decode_list_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + SseDeserializer deserializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + + final len_ = sse_decode_i_32(deserializer); + final ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add( + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + deserializer, + ), + ); + } + return ans_; + } + @protected List sse_decode_list_Char(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -1553,12 +2017,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return deserializer.buffer.getBigUint64(); } - @protected - bool sse_decode_bool(SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - return deserializer.buffer.getUint8() != 0; - } - @protected void sse_encode_AnyhowException( AnyhowException self, @@ -1607,6 +2065,32 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ); } + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + JiebaRs self, + SseSerializer serializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as JiebaRsImpl).frbInternalSseEncode(move: true), + serializer, + ); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + Keyword self, + SseSerializer serializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as KeywordImpl).frbInternalSseEncode(move: true), + serializer, + ); + } + @protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( @@ -1633,6 +2117,19 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ); } + @protected + void + sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + Keyword self, + SseSerializer serializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as KeywordImpl).frbInternalSseEncode(move: false), + serializer, + ); + } + @protected void sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( @@ -1648,13 +2145,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { @protected void - sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - DynamicImage self, + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + Keyword self, SseSerializer serializer, ) { // Codec=Sse (Serialization based), see doc to use other codecs sse_encode_usize( - (self as DynamicImageImpl).frbInternalSseEncode(move: false), + (self as KeywordImpl).frbInternalSseEncode(move: false), serializer, ); } @@ -1702,19 +2199,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ); } - @protected - void - sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - DynamicImage self, - SseSerializer serializer, - ) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_usize( - (self as DynamicImageImpl).frbInternalSseEncode(move: null), - serializer, - ); - } - @protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( @@ -1741,6 +2225,32 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ); } + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + JiebaRs self, + SseSerializer serializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as JiebaRsImpl).frbInternalSseEncode(move: null), + serializer, + ); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + Keyword self, + SseSerializer serializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as KeywordImpl).frbInternalSseEncode(move: null), + serializer, + ); + } + @protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( @@ -1773,6 +2283,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_list_prim_u_8_strict(utf8.encoder.convert(self), serializer); } + @protected + void sse_encode_bool(bool self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putUint8(self ? 1 : 0); + } + @protected void sse_encode_box_autoadd_compress_format( CompressFormat self, @@ -1809,12 +2325,34 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { serializer.buffer.putFloat32(self); } + @protected + void sse_encode_f_64(double self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putFloat64(self); + } + @protected void sse_encode_i_32(int self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs serializer.buffer.putInt32(self); } + @protected + void + sse_encode_list_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + List self, + SseSerializer serializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + item, + serializer, + ); + } + } + @protected void sse_encode_list_Char(List self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -1974,12 +2512,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { // Codec=Sse (Serialization based), see doc to use other codecs serializer.buffer.putBigUint64(self); } - - @protected - void sse_encode_bool(bool self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - serializer.buffer.putUint8(self ? 1 : 0); - } } @sealed @@ -2002,26 +2534,6 @@ class AesEncryptionImpl extends RustOpaque implements AesEncryption { ); } -@sealed -class DynamicImageImpl extends RustOpaque implements DynamicImage { - // Not to be used by end users - DynamicImageImpl.frbInternalDcoDecode(List wire) - : super.frbInternalDcoDecode(wire, _kStaticData); - - // Not to be used by end users - DynamicImageImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) - : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); - - static final _kStaticData = RustArcStaticData( - rustArcIncrementStrongCount: - RustLib.instance.api.rust_arc_increment_strong_count_DynamicImage, - rustArcDecrementStrongCount: - RustLib.instance.api.rust_arc_decrement_strong_count_DynamicImage, - rustArcDecrementStrongCountPtr: - RustLib.instance.api.rust_arc_decrement_strong_count_DynamicImagePtr, - ); -} - @sealed class FontReaderImpl extends RustOpaque implements FontReader { // Not to be used by end users @@ -2062,6 +2574,58 @@ class ImageCompressImpl extends RustOpaque implements ImageCompress { ); } +@sealed +class JiebaRsImpl extends RustOpaque implements JiebaRs { + // Not to be used by end users + JiebaRsImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + JiebaRsImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_JiebaRs, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_JiebaRs, + rustArcDecrementStrongCountPtr: + RustLib.instance.api.rust_arc_decrement_strong_count_JiebaRsPtr, + ); +} + +@sealed +class KeywordImpl extends RustOpaque implements Keyword { + // Not to be used by end users + KeywordImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + KeywordImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_Keyword, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_Keyword, + rustArcDecrementStrongCountPtr: + RustLib.instance.api.rust_arc_decrement_strong_count_KeywordPtr, + ); + + String get keyword => RustLib.instance.api + .crateApiJiebaKeywordAutoAccessorGetKeyword(that: this); + + double get weight => RustLib.instance.api + .crateApiJiebaKeywordAutoAccessorGetWeight(that: this); + + set keyword(String keyword) => RustLib.instance.api + .crateApiJiebaKeywordAutoAccessorSetKeyword(that: this, keyword: keyword); + + set weight(double weight) => RustLib.instance.api + .crateApiJiebaKeywordAutoAccessorSetWeight(that: this, weight: weight); +} + @sealed class KmpImpl extends RustOpaque implements Kmp { // Not to be used by end users diff --git a/lib/src/rust/frb_generated.io.dart b/lib/src/rust/frb_generated.io.dart index bb9da08..c3cba59 100644 --- a/lib/src/rust/frb_generated.io.dart +++ b/lib/src/rust/frb_generated.io.dart @@ -3,19 +3,18 @@ // ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field -import 'dart:async'; -import 'dart:convert'; -import 'dart:ffi' as ffi; - -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_io.dart'; - import 'api/aes.dart'; import 'api/compress.dart'; import 'api/constants.dart'; import 'api/font.dart'; +import 'api/jieba.dart'; import 'api/kmp.dart'; import 'api/zip.dart'; +import 'dart:async'; +import 'dart:convert'; +import 'dart:ffi' as ffi; import 'frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_io.dart'; abstract class RustLibApiImplPlatform extends BaseApiImpl { RustLibApiImplPlatform({ @@ -29,10 +28,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { get rust_arc_decrement_strong_count_AesEncryptionPtr => wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryptionPtr; - CrossPlatformFinalizerArg - get rust_arc_decrement_strong_count_DynamicImagePtr => - wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImagePtr; - CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_FontReaderPtr => wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReaderPtr; @@ -40,6 +35,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { get rust_arc_decrement_strong_count_ImageCompressPtr => wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompressPtr; + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_JiebaRsPtr => + wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRsPtr; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_KeywordPtr => + wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeywordPtr; + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_KmpPtr => wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmpPtr; @@ -67,6 +68,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { dynamic raw, ); + @protected + JiebaRs + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + dynamic raw, + ); + + @protected + Keyword + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + dynamic raw, + ); + @protected Kmp dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( @@ -79,6 +92,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { dynamic raw, ); + @protected + Keyword + dco_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + dynamic raw, + ); + @protected Zip dco_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( @@ -86,8 +105,8 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { ); @protected - DynamicImage - dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( + Keyword + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( dynamic raw, ); @@ -106,12 +125,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { dynamic raw, ); - @protected - DynamicImage - dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - dynamic raw, - ); - @protected FontReader dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( @@ -124,6 +137,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { dynamic raw, ); + @protected + JiebaRs + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + dynamic raw, + ); + + @protected + Keyword + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + dynamic raw, + ); + @protected Kmp dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( @@ -139,6 +164,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected String dco_decode_String(dynamic raw); + @protected + bool dco_decode_bool(dynamic raw); + @protected CompressFormat dco_decode_box_autoadd_compress_format(dynamic raw); @@ -154,9 +182,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected double dco_decode_f_32(dynamic raw); + @protected + double dco_decode_f_64(dynamic raw); + @protected int dco_decode_i_32(dynamic raw); + @protected + List + dco_decode_list_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + dynamic raw, + ); + @protected List dco_decode_list_Char(dynamic raw); @@ -229,6 +266,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseDeserializer deserializer, ); + @protected + JiebaRs + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + SseDeserializer deserializer, + ); + + @protected + Keyword + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + SseDeserializer deserializer, + ); + @protected Kmp sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( @@ -241,6 +290,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseDeserializer deserializer, ); + @protected + Keyword + sse_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + SseDeserializer deserializer, + ); + @protected Zip sse_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( @@ -248,8 +303,8 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { ); @protected - DynamicImage - sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( + Keyword + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( SseDeserializer deserializer, ); @@ -272,12 +327,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseDeserializer deserializer, ); - @protected - DynamicImage - sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - SseDeserializer deserializer, - ); - @protected FontReader sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( @@ -290,6 +339,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseDeserializer deserializer, ); + @protected + JiebaRs + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + SseDeserializer deserializer, + ); + + @protected + Keyword + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + SseDeserializer deserializer, + ); + @protected Kmp sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( @@ -305,6 +366,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected String sse_decode_String(SseDeserializer deserializer); + @protected + bool sse_decode_bool(SseDeserializer deserializer); + @protected CompressFormat sse_decode_box_autoadd_compress_format( SseDeserializer deserializer, @@ -322,9 +386,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected double sse_decode_f_32(SseDeserializer deserializer); + @protected + double sse_decode_f_64(SseDeserializer deserializer); + @protected int sse_decode_i_32(SseDeserializer deserializer); + @protected + List + sse_decode_list_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + SseDeserializer deserializer, + ); + @protected List sse_decode_list_Char(SseDeserializer deserializer); @@ -384,9 +457,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected BigInt sse_decode_usize(SseDeserializer deserializer); - @protected - bool sse_decode_bool(SseDeserializer deserializer); - @protected void sse_encode_AnyhowException( AnyhowException self, @@ -414,6 +484,20 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + JiebaRs self, + SseSerializer serializer, + ); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + Keyword self, + SseSerializer serializer, + ); + @protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( @@ -428,6 +512,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void + sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + Keyword self, + SseSerializer serializer, + ); + @protected void sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( @@ -437,8 +528,8 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void - sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - DynamicImage self, + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + Keyword self, SseSerializer serializer, ); @@ -464,13 +555,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); - @protected - void - sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - DynamicImage self, - SseSerializer serializer, - ); - @protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( @@ -485,6 +569,20 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + JiebaRs self, + SseSerializer serializer, + ); + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + Keyword self, + SseSerializer serializer, + ); + @protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( @@ -502,6 +600,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_String(String self, SseSerializer serializer); + @protected + void sse_encode_bool(bool self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_compress_format( CompressFormat self, @@ -523,9 +624,19 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_f_32(double self, SseSerializer serializer); + @protected + void sse_encode_f_64(double self, SseSerializer serializer); + @protected void sse_encode_i_32(int self, SseSerializer serializer); + @protected + void + sse_encode_list_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + List self, + SseSerializer serializer, + ); + @protected void sse_encode_list_Char(List self, SseSerializer serializer); @@ -597,9 +708,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_usize(BigInt self, SseSerializer serializer); - - @protected - void sse_encode_bool(bool self, SseSerializer serializer); } // Section: wire_class @@ -650,40 +758,6 @@ class RustLibWire implements BaseWire { _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryptionPtr .asFunction)>(); - void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - ffi.Pointer ptr, - ) { - return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - ptr, - ); - } - - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImagePtr = - _lookup)>>( - 'frbgen_moodiary_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage', - ); - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage = - _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImagePtr - .asFunction)>(); - - void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - ffi.Pointer ptr, - ) { - return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - ptr, - ); - } - - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImagePtr = - _lookup)>>( - 'frbgen_moodiary_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage', - ); - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage = - _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImagePtr - .asFunction)>(); - void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( ffi.Pointer ptr, @@ -752,6 +826,74 @@ class RustLibWire implements BaseWire { _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompressPtr .asFunction)>(); + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRsPtr = + _lookup)>>( + 'frbgen_moodiary_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs', + ); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRsPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRsPtr = + _lookup)>>( + 'frbgen_moodiary_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs', + ); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRsPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeywordPtr = + _lookup)>>( + 'frbgen_moodiary_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword', + ); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeywordPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeywordPtr = + _lookup)>>( + 'frbgen_moodiary_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword', + ); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeywordPtr + .asFunction)>(); + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( ffi.Pointer ptr, diff --git a/lib/src/rust/frb_generated.web.dart b/lib/src/rust/frb_generated.web.dart deleted file mode 100644 index b35c9ce..0000000 --- a/lib/src/rust/frb_generated.web.dart +++ /dev/null @@ -1,774 +0,0 @@ -// This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.9.0. - -// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field - -// Static analysis wrongly picks the IO variant, thus ignore this -// ignore_for_file: argument_type_not_assignable - -import 'dart:async'; -import 'dart:convert'; - -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_web.dart'; - -import 'api/aes.dart'; -import 'api/compress.dart'; -import 'api/constants.dart'; -import 'api/font.dart'; -import 'api/kmp.dart'; -import 'api/zip.dart'; -import 'frb_generated.dart'; - -abstract class RustLibApiImplPlatform extends BaseApiImpl { - RustLibApiImplPlatform({ - required super.handler, - required super.wire, - required super.generalizedFrbRustBinding, - required super.portManager, - }); - - CrossPlatformFinalizerArg - get rust_arc_decrement_strong_count_AesEncryptionPtr => - wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption; - - CrossPlatformFinalizerArg - get rust_arc_decrement_strong_count_DynamicImagePtr => - wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage; - - CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_FontReaderPtr => - wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader; - - CrossPlatformFinalizerArg - get rust_arc_decrement_strong_count_ImageCompressPtr => - wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress; - - CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_KmpPtr => - wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp; - - CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ZipPtr => - wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip; - - @protected - AnyhowException dco_decode_AnyhowException(dynamic raw); - - @protected - AesEncryption - dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - dynamic raw, - ); - - @protected - FontReader - dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - dynamic raw, - ); - - @protected - ImageCompress - dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - dynamic raw, - ); - - @protected - Kmp - dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - dynamic raw, - ); - - @protected - Zip - dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - dynamic raw, - ); - - @protected - Zip - dco_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - dynamic raw, - ); - - @protected - DynamicImage - dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - dynamic raw, - ); - - @protected - String dco_decode_Char(dynamic raw); - - @protected - Map dco_decode_Map_String_String_None(dynamic raw); - - @protected - Map dco_decode_Map_String_f_32_None(dynamic raw); - - @protected - AesEncryption - dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - dynamic raw, - ); - - @protected - DynamicImage - dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - dynamic raw, - ); - - @protected - FontReader - dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - dynamic raw, - ); - - @protected - ImageCompress - dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - dynamic raw, - ); - - @protected - Kmp - dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - dynamic raw, - ); - - @protected - Zip - dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - dynamic raw, - ); - - @protected - String dco_decode_String(dynamic raw); - - @protected - CompressFormat dco_decode_box_autoadd_compress_format(dynamic raw); - - @protected - int dco_decode_box_autoadd_u_32(dynamic raw); - - @protected - int dco_decode_box_autoadd_u_8(dynamic raw); - - @protected - CompressFormat dco_decode_compress_format(dynamic raw); - - @protected - double dco_decode_f_32(dynamic raw); - - @protected - int dco_decode_i_32(dynamic raw); - - @protected - List dco_decode_list_Char(dynamic raw); - - @protected - List dco_decode_list_String(dynamic raw); - - @protected - List dco_decode_list_prim_u_8_loose(dynamic raw); - - @protected - Uint8List dco_decode_list_prim_u_8_strict(dynamic raw); - - @protected - Uint64List dco_decode_list_prim_usize_strict(dynamic raw); - - @protected - List<(String, double)> dco_decode_list_record_string_f_32(dynamic raw); - - @protected - List<(String, String)> dco_decode_list_record_string_string(dynamic raw); - - @protected - String? dco_decode_opt_String(dynamic raw); - - @protected - CompressFormat? dco_decode_opt_box_autoadd_compress_format(dynamic raw); - - @protected - int? dco_decode_opt_box_autoadd_u_32(dynamic raw); - - @protected - int? dco_decode_opt_box_autoadd_u_8(dynamic raw); - - @protected - (String, double) dco_decode_record_string_f_32(dynamic raw); - - @protected - (String, String) dco_decode_record_string_string(dynamic raw); - - @protected - int dco_decode_u_32(dynamic raw); - - @protected - int dco_decode_u_8(dynamic raw); - - @protected - void dco_decode_unit(dynamic raw); - - @protected - BigInt dco_decode_usize(dynamic raw); - - @protected - AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer); - - @protected - AesEncryption - sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - SseDeserializer deserializer, - ); - - @protected - FontReader - sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - SseDeserializer deserializer, - ); - - @protected - ImageCompress - sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - SseDeserializer deserializer, - ); - - @protected - Kmp - sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - SseDeserializer deserializer, - ); - - @protected - Zip - sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - SseDeserializer deserializer, - ); - - @protected - Zip - sse_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - SseDeserializer deserializer, - ); - - @protected - DynamicImage - sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - SseDeserializer deserializer, - ); - - @protected - String sse_decode_Char(SseDeserializer deserializer); - - @protected - Map sse_decode_Map_String_String_None( - SseDeserializer deserializer, - ); - - @protected - Map sse_decode_Map_String_f_32_None( - SseDeserializer deserializer, - ); - - @protected - AesEncryption - sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - SseDeserializer deserializer, - ); - - @protected - DynamicImage - sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - SseDeserializer deserializer, - ); - - @protected - FontReader - sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - SseDeserializer deserializer, - ); - - @protected - ImageCompress - sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - SseDeserializer deserializer, - ); - - @protected - Kmp - sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - SseDeserializer deserializer, - ); - - @protected - Zip - sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - SseDeserializer deserializer, - ); - - @protected - String sse_decode_String(SseDeserializer deserializer); - - @protected - CompressFormat sse_decode_box_autoadd_compress_format( - SseDeserializer deserializer, - ); - - @protected - int sse_decode_box_autoadd_u_32(SseDeserializer deserializer); - - @protected - int sse_decode_box_autoadd_u_8(SseDeserializer deserializer); - - @protected - CompressFormat sse_decode_compress_format(SseDeserializer deserializer); - - @protected - double sse_decode_f_32(SseDeserializer deserializer); - - @protected - int sse_decode_i_32(SseDeserializer deserializer); - - @protected - List sse_decode_list_Char(SseDeserializer deserializer); - - @protected - List sse_decode_list_String(SseDeserializer deserializer); - - @protected - List sse_decode_list_prim_u_8_loose(SseDeserializer deserializer); - - @protected - Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer); - - @protected - Uint64List sse_decode_list_prim_usize_strict(SseDeserializer deserializer); - - @protected - List<(String, double)> sse_decode_list_record_string_f_32( - SseDeserializer deserializer, - ); - - @protected - List<(String, String)> sse_decode_list_record_string_string( - SseDeserializer deserializer, - ); - - @protected - String? sse_decode_opt_String(SseDeserializer deserializer); - - @protected - CompressFormat? sse_decode_opt_box_autoadd_compress_format( - SseDeserializer deserializer, - ); - - @protected - int? sse_decode_opt_box_autoadd_u_32(SseDeserializer deserializer); - - @protected - int? sse_decode_opt_box_autoadd_u_8(SseDeserializer deserializer); - - @protected - (String, double) sse_decode_record_string_f_32(SseDeserializer deserializer); - - @protected - (String, String) sse_decode_record_string_string( - SseDeserializer deserializer, - ); - - @protected - int sse_decode_u_32(SseDeserializer deserializer); - - @protected - int sse_decode_u_8(SseDeserializer deserializer); - - @protected - void sse_decode_unit(SseDeserializer deserializer); - - @protected - BigInt sse_decode_usize(SseDeserializer deserializer); - - @protected - bool sse_decode_bool(SseDeserializer deserializer); - - @protected - void sse_encode_AnyhowException( - AnyhowException self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - AesEncryption self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - FontReader self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - ImageCompress self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - Kmp self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - Zip self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - Zip self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - DynamicImage self, - SseSerializer serializer, - ); - - @protected - void sse_encode_Char(String self, SseSerializer serializer); - - @protected - void sse_encode_Map_String_String_None( - Map self, - SseSerializer serializer, - ); - - @protected - void sse_encode_Map_String_f_32_None( - Map self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - AesEncryption self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - DynamicImage self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - FontReader self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - ImageCompress self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - Kmp self, - SseSerializer serializer, - ); - - @protected - void - sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - Zip self, - SseSerializer serializer, - ); - - @protected - void sse_encode_String(String self, SseSerializer serializer); - - @protected - void sse_encode_box_autoadd_compress_format( - CompressFormat self, - SseSerializer serializer, - ); - - @protected - void sse_encode_box_autoadd_u_32(int self, SseSerializer serializer); - - @protected - void sse_encode_box_autoadd_u_8(int self, SseSerializer serializer); - - @protected - void sse_encode_compress_format( - CompressFormat self, - SseSerializer serializer, - ); - - @protected - void sse_encode_f_32(double self, SseSerializer serializer); - - @protected - void sse_encode_i_32(int self, SseSerializer serializer); - - @protected - void sse_encode_list_Char(List self, SseSerializer serializer); - - @protected - void sse_encode_list_String(List self, SseSerializer serializer); - - @protected - void sse_encode_list_prim_u_8_loose(List self, SseSerializer serializer); - - @protected - void sse_encode_list_prim_u_8_strict( - Uint8List self, - SseSerializer serializer, - ); - - @protected - void sse_encode_list_prim_usize_strict( - Uint64List self, - SseSerializer serializer, - ); - - @protected - void sse_encode_list_record_string_f_32( - List<(String, double)> self, - SseSerializer serializer, - ); - - @protected - void sse_encode_list_record_string_string( - List<(String, String)> self, - SseSerializer serializer, - ); - - @protected - void sse_encode_opt_String(String? self, SseSerializer serializer); - - @protected - void sse_encode_opt_box_autoadd_compress_format( - CompressFormat? self, - SseSerializer serializer, - ); - - @protected - void sse_encode_opt_box_autoadd_u_32(int? self, SseSerializer serializer); - - @protected - void sse_encode_opt_box_autoadd_u_8(int? self, SseSerializer serializer); - - @protected - void sse_encode_record_string_f_32( - (String, double) self, - SseSerializer serializer, - ); - - @protected - void sse_encode_record_string_string( - (String, String) self, - SseSerializer serializer, - ); - - @protected - void sse_encode_u_32(int self, SseSerializer serializer); - - @protected - void sse_encode_u_8(int self, SseSerializer serializer); - - @protected - void sse_encode_unit(void self, SseSerializer serializer); - - @protected - void sse_encode_usize(BigInt self, SseSerializer serializer); - - @protected - void sse_encode_bool(bool self, SseSerializer serializer); -} - -// Section: wire_class - -class RustLibWire implements BaseWire { - RustLibWire.fromExternalLibrary(ExternalLibrary lib); - - void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - int ptr, - ) => wasmModule - .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - ptr, - ); - - void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - int ptr, - ) => wasmModule - .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - ptr, - ); - - void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - int ptr, - ) => wasmModule - .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - ptr, - ); - - void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - int ptr, - ) => wasmModule - .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - ptr, - ); - - void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - int ptr, - ) => wasmModule - .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - ptr, - ); - - void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - int ptr, - ) => wasmModule - .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - ptr, - ); - - void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - int ptr, - ) => wasmModule - .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - ptr, - ); - - void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - int ptr, - ) => wasmModule - .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - ptr, - ); - - void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - int ptr, - ) => wasmModule - .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - ptr, - ); - - void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - int ptr, - ) => wasmModule - .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - ptr, - ); - - void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - int ptr, - ) => wasmModule - .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - ptr, - ); - - void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - int ptr, - ) => wasmModule - .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - ptr, - ); -} - -@JS('wasm_bindgen') -external RustLibWasmModule get wasmModule; - -@JS() -@anonymous -extension type RustLibWasmModule._(JSObject _) implements JSObject { - external void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - int ptr, - ); - - external void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - int ptr, - ); - - external void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - int ptr, - ); - - external void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - int ptr, - ); - - external void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - int ptr, - ); - - external void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - int ptr, - ); - - external void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - int ptr, - ); - - external void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - int ptr, - ); - - external void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - int ptr, - ); - - external void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - int ptr, - ); - - external void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - int ptr, - ); - - external void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - int ptr, - ); -} diff --git a/pubspec.lock b/pubspec.lock index a536f43..dd5e79a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -30,14 +30,6 @@ packages: url: "https://pub.dev" source: hosted version: "6.11.0" - analyzer_plugin: - dependency: transitive - description: - name: analyzer_plugin - sha256: "9661b30b13a685efaee9f02e5d01ed9f2b423bd889d28a304d02d704aee69161" - url: "https://pub.dev" - source: hosted - version: "0.11.3" animated_stack_widget: dependency: transitive description: @@ -402,10 +394,10 @@ packages: dependency: "direct main" description: name: chewie - sha256: df6711bc3ba165ad19cb496e350250be5673327f79c61c9cc8a15088ed8007ed + sha256: "4d9554a8f87cc2dc6575dfd5ad20a4375015a29edd567fd6733febe6365e2566" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.11.3" cli_util: dependency: transitive description: @@ -518,22 +510,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.8" - custom_lint_core: - dependency: transitive - description: - name: custom_lint_core - sha256: "02450c3e45e2a6e8b26c4d16687596ab3c4644dd5792e3313aa9ceba5a49b7f5" - url: "https://pub.dev" - source: hosted - version: "0.7.0" - custom_lint_visitor: - dependency: transitive - description: - name: custom_lint_visitor - sha256: bfe9b7a09c4775a587b58d10ebb871d4fe618237639b1e84d5ec62d7dfef25f9 - url: "https://pub.dev" - source: hosted - version: "1.0.0+6.11.0" dart_earcut: dependency: transitive description: @@ -554,10 +530,10 @@ packages: dependency: transitive description: name: dart_style - sha256: "7306ab8a2359a48d22310ad823521d723acfed60ee1f7e37388e8986853b6820" + sha256: "27eb0ae77836989a3bc541ce55595e8ceee0992807f14511552a898ddd0d88ac" url: "https://pub.dev" source: hosted - version: "2.3.8" + version: "3.0.1" dartx: dependency: "direct main" description: @@ -1104,14 +1080,6 @@ packages: url: "https://pub.dev" source: hosted version: "11.0.0" - flutter_riverpod: - dependency: "direct main" - description: - name: flutter_riverpod - sha256: "9532ee6db4a943a1ed8383072a2e3eeda041db5657cdf6d2acecf3c21ecbe7e1" - url: "https://pub.dev" - source: hosted - version: "2.6.1" flutter_rust_bridge: dependency: "direct main" description: @@ -1202,14 +1170,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0-dev.3" + freezed: + dependency: "direct dev" + description: + name: freezed + sha256: "6022db4c7bfa626841b2a10f34dd1e1b68e8f8f9650db6112dcdeeca45ca793c" + url: "https://pub.dev" + source: hosted + version: "3.0.6" freezed_annotation: dependency: "direct main" description: name: freezed_annotation - sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 + sha256: c87ff004c8aa6af2d531668b46a4ea379f7191dc6dfa066acd53d506da6e044b url: "https://pub.dev" source: hosted - version: "2.4.4" + version: "3.0.0" frontend_server_client: dependency: transitive description: @@ -1567,10 +1543,10 @@ packages: dependency: "direct dev" description: name: json_serializable - sha256: c2fcb3920cf2b6ae6845954186420fca40bc0a8abcc84903b7801f17d7050d7c + sha256: c50ef5fc083d5b5e12eef489503ba3bf5ccc899e487d691584699b4bdefeea8c url: "https://pub.dev" source: hosted - version: "6.9.0" + version: "6.9.5" jwt_decode: dependency: transitive description: @@ -2086,10 +2062,10 @@ packages: dependency: transitive description: name: posix - sha256: a0117dc2167805aa9125b82eee515cc891819bac2f538c83646d355b16f58b9a + sha256: f0d7856b6ca1887cfa6d1d394056a296ae33489db914e365e2044fdada449e62 url: "https://pub.dev" source: hosted - version: "6.0.1" + version: "6.0.2" postgrest: dependency: transitive description: @@ -2306,38 +2282,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.2" - riverpod: - dependency: transitive - description: - name: riverpod - sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959" - url: "https://pub.dev" - source: hosted - version: "2.6.1" - riverpod_analyzer_utils: - dependency: transitive - description: - name: riverpod_analyzer_utils - sha256: c6b8222b2b483cb87ae77ad147d6408f400c64f060df7a225b127f4afef4f8c8 - url: "https://pub.dev" - source: hosted - version: "0.5.8" - riverpod_annotation: - dependency: "direct main" - description: - name: riverpod_annotation - sha256: e14b0bf45b71326654e2705d462f21b958f987087be850afd60578fcd502d1b8 - url: "https://pub.dev" - source: hosted - version: "2.6.1" - riverpod_generator: - dependency: "direct dev" - description: - name: riverpod_generator - sha256: "63546d70952015f0981361636bf8f356d9cfd9d7f6f0815e3c07789a41233188" - url: "https://pub.dev" - source: hosted - version: "2.6.3" rxdart: dependency: "direct main" description: @@ -2512,13 +2456,13 @@ packages: source: hosted version: "1.2.1" source_gen: - dependency: transitive + dependency: "direct overridden" description: name: source_gen - sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b" url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "2.0.0" source_helper: dependency: transitive description: @@ -2591,14 +2535,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.12.1" - state_notifier: - dependency: transitive - description: - name: state_notifier - sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb - url: "https://pub.dev" - source: hosted - version: "1.0.0" storage_client: dependency: transitive description: @@ -2899,10 +2835,10 @@ packages: dependency: transitive description: name: video_player_avfoundation - sha256: "84b4752745eeccb6e75865c9aab39b3d28eb27ba5726d352d45db8297fbd75bc" + sha256: "9ee764e5cd2fc1e10911ae8ad588e1a19db3b6aa9a6eb53c127c42d3a3c3f22f" url: "https://pub.dev" source: hosted - version: "2.7.0" + version: "2.7.1" video_player_media_kit: dependency: "direct main" description: @@ -2952,21 +2888,21 @@ packages: source: hosted version: "3.3.3" wakelock_plus: - dependency: transitive + dependency: "direct main" description: name: wakelock_plus - sha256: b90fbcc8d7bdf3b883ea9706d9d76b9978cb1dfa4351fcc8014d6ec31a493354 + sha256: b6962cd9fc15e4843b573ba7b53bc46dd8a787594cf9ed5c5182581924656a58 url: "https://pub.dev" source: hosted - version: "1.2.11" + version: "1.3.1" wakelock_plus_platform_interface: dependency: transitive description: name: wakelock_plus_platform_interface - sha256: "70e780bc99796e1db82fe764b1e7dcb89a86f1e5b3afb1db354de50f2e41eb7a" + sha256: e10444072e50dbc4999d7316fd303f7ea53d31c824aa5eb05d7ccbdd98985207 url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "1.2.3" watcher: dependency: transitive description: @@ -2995,18 +2931,18 @@ packages: dependency: transitive description: name: web_socket - sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + sha256: bfe6f435f6ec49cb6c01da1e275ae4228719e59a6b067048c51e72d9d63bcc4b url: "https://pub.dev" source: hosted - version: "0.1.6" + version: "1.0.0" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "0b8e2457400d8a859b7b2030786835a28a8e80836ef64402abef392ff4f1d0e5" + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" webdav_client: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 721d80f..aca51c6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -81,7 +81,7 @@ dependencies: image_picker_android: 0.8.12+22 video_player_media_kit: 1.0.6 video_player: 2.9.5 - chewie: 1.11.1 + chewie: 1.11.3 flutter_markdown: 0.7.7 image_picker_platform_interface: 2.10.1 flutter_image_compress: 2.4.0 @@ -113,10 +113,6 @@ dependencies: photo_view: 0.15.0 dartx: 1.2.0 material_color_utilities: 0.11.1 - flutter_riverpod: 2.6.1 - riverpod_annotation: 2.6.1 - freezed_annotation: 2.4.4 - json_annotation: 4.9.0 audioplayers_android_exo: 0.1.2 scrollview_observer: 1.26.0 flutter_smart_dialog: 4.9.8+7 @@ -129,6 +125,9 @@ dependencies: hive_ce: 2.10.1 hive_ce_flutter: 2.2.0 flutter_modular: 6.3.4 + freezed_annotation: 3.0.0 + json_annotation: 4.9.0 + wakelock_plus: 1.3.1 dev_dependencies: flutter_test: @@ -137,11 +136,13 @@ dev_dependencies: flutter_launcher_icons: 0.14.3 msix: 3.16.8 flutter_lints: 5.0.0 - riverpod_generator: 2.6.3 - json_serializable: 6.9.0 flutter_gen: 5.10.0 flutter_gen_runner: 5.10.0 + freezed: 3.0.6 + json_serializable: 6.9.5 +dependency_overrides: + source_gen: 2.0.0 flutter_launcher_icons: diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 65ffe5c..19d239e 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -17,6 +17,12 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "adler32" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" + [[package]] name = "aes" version = "0.8.4" @@ -28,6 +34,18 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy 0.7.35", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -54,6 +72,12 @@ dependencies = [ "backtrace", ] +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "android_log-sys" version = "0.3.2" @@ -253,6 +277,15 @@ dependencies = [ "shlex", ] +[[package]] +name = "cedarwood" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d910bedd62c24733263d0bed247460853c9d22e8956bd4cd964302095e04e90" +dependencies = [ + "smallvec", +] + [[package]] name = "cfg-expr" version = "0.15.8" @@ -301,6 +334,15 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + [[package]] name = "cpufeatures" version = "0.2.17" @@ -375,6 +417,41 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "dart-sys" version = "4.1.5" @@ -384,6 +461,12 @@ dependencies = [ "cc", ] +[[package]] +name = "dary_heap" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04d2cd9c18b9f454ed67da600630b021a8a80bf33f8c95896ab33aaf1c26b728" + [[package]] name = "dashmap" version = "4.0.2" @@ -431,6 +514,37 @@ dependencies = [ "syn", ] +[[package]] +name = "derive_builder" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_builder_macro" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" +dependencies = [ + "derive_builder_core", + "syn", +] + [[package]] name = "digest" version = "0.10.7" @@ -563,6 +677,12 @@ dependencies = [ "syn", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "futures" version = "0.3.31" @@ -652,6 +772,15 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -713,6 +842,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] + [[package]] name = "hashbrown" version = "0.15.2" @@ -746,6 +885,12 @@ dependencies = [ "digest", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "image" version = "0.25.6" @@ -785,6 +930,29 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408" +[[package]] +name = "include-flate" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df49c16750695486c1f34de05da5b7438096156466e7f76c38fcdf285cf0113e" +dependencies = [ + "include-flate-codegen", + "lazy_static", + "libflate", +] + +[[package]] +name = "include-flate-codegen" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c5b246c6261be723b85c61ecf87804e8ea4a35cb68be0ff282ed84b95ffe7d7" +dependencies = [ + "libflate", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "indexmap" version = "2.9.0" @@ -792,7 +960,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.2", ] [[package]] @@ -824,6 +992,32 @@ dependencies = [ "either", ] +[[package]] +name = "jieba-macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c676b32a471d3cfae8dac2ad2f8334cd52e53377733cca8c1fb0a5062fec192" +dependencies = [ + "phf_codegen", +] + +[[package]] +name = "jieba-rs" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d1bcad6332969e4d48ee568d430e14ee6dea70740c2549d005d87677ebefb0c" +dependencies = [ + "cedarwood", + "derive_builder", + "fxhash", + "include-flate", + "jieba-macros", + "lazy_static", + "ordered-float", + "phf", + "regex", +] + [[package]] name = "jobserver" version = "0.1.33" @@ -868,6 +1062,30 @@ version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +[[package]] +name = "libflate" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45d9dfdc14ea4ef0900c1cddbc8dcd553fbaacd8a4a282cf4018ae9dd04fb21e" +dependencies = [ + "adler32", + "core2", + "crc32fast", + "dary_heap", + "libflate_lz77", +] + +[[package]] +name = "libflate_lz77" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e0d73b369f386f1c44abd9c570d5318f55ccde816ff4b562fa452e5182863d" +dependencies = [ + "core2", + "hashbrown 0.14.5", + "rle-decode-fast", +] + [[package]] name = "libfuzzer-sys" version = "0.4.9" @@ -976,7 +1194,10 @@ dependencies = [ "fast_image_resize", "flutter_rust_bridge", "image", + "jieba-rs", + "once_cell", "ring", + "tokio", "ttf-parser", "walkdir", "zip", @@ -1085,6 +1306,15 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "ordered-float" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951" +dependencies = [ + "num-traits", +] + [[package]] name = "oslog" version = "0.1.0" @@ -1112,6 +1342,44 @@ dependencies = [ "hmac", ] +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -1161,7 +1429,7 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy", + "zerocopy 0.8.24", ] [[package]] @@ -1371,6 +1639,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rle-decode-fast" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -1453,6 +1727,12 @@ dependencies = [ "quote", ] +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "slab" version = "0.4.9" @@ -1468,6 +1748,12 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "subtle" version = "2.6.1" @@ -1883,13 +2169,33 @@ dependencies = [ "lzma-sys", ] +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive 0.7.35", +] + [[package]] name = "zerocopy" version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.8.24", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 62355eb..887c45b 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -15,6 +15,9 @@ ttf-parser = { git = "https://github.com/ZhuJHua/ttf-parser", branch = "fvar" } ring = "0.17.14" zip = "2.6.1" walkdir = "2.5.0" +jieba-rs = { version = "0.7.2", features = ["default-dict", "tfidf", "textrank"] } +once_cell = "1.21.3" +tokio = "1.44.2" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] } diff --git a/rust/src/api/compress.rs b/rust/src/api/compress.rs index 7769e7f..94239f7 100644 --- a/rust/src/api/compress.rs +++ b/rust/src/api/compress.rs @@ -16,7 +16,7 @@ use image::{ use super::constants::CompressFormat; -pub fn compress( +fn compress( img: &DynamicImage, dst_height: u32, dst_width: u32, @@ -84,7 +84,10 @@ impl ImageCompress { max_height: Option, quality: Option, ) -> Result> { - let src_img = Self::load_image(&file_path)?; + let src_img = ImageReader::open(file_path)? + .with_guessed_format()? + .decode() + .map_err(|e| anyhow::anyhow!("Failed to decode image: {}", e))?; let compress_format = compress_format.unwrap_or(CompressFormat::Jpeg); let quality = quality.unwrap_or(80); @@ -137,13 +140,6 @@ impl ImageCompress { (max_width, (img_height as f64 * ratio).round() as u32) } } - - fn load_image(file_path: &str) -> Result { - ImageReader::open(file_path)? - .with_guessed_format()? - .decode() - .map_err(|e| anyhow::anyhow!("Failed to decode image: {}", e)) - } } pub struct ResizeOptions { pub target_width: Option, diff --git a/rust/src/api/jieba.rs b/rust/src/api/jieba.rs new file mode 100644 index 0000000..be1ae4b --- /dev/null +++ b/rust/src/api/jieba.rs @@ -0,0 +1,126 @@ +use anyhow::{Context, Ok, Result}; +use flutter_rust_bridge::frb; +use jieba_rs::{Jieba, KeywordExtract, TextRank, TfIdf}; +use once_cell::sync::OnceCell; +use std::collections::HashSet; +use std::sync::Arc; +use tokio::sync::OnceCell as AsyncOnceCell; + +#[frb(opaque)] +pub struct JiebaRs { + inner: Jieba, + tfidf: OnceCell, + text_rank: OnceCell, +} + +#[derive(Debug, Clone)] +#[frb(opaque)] +pub struct Keyword { + pub keyword: String, + pub weight: f64, +} + +static GLOBAL_JIEBA: AsyncOnceCell> = AsyncOnceCell::const_new(); + +#[frb(init)] +pub async fn init_jieba() { + JiebaRs::init_global().await; +} + +impl JiebaRs { + fn new() -> Self { + Self { + inner: Jieba::new(), + tfidf: OnceCell::new(), + text_rank: OnceCell::new(), + } + } + + async fn init_global() { + GLOBAL_JIEBA + .get_or_init(|| async { + let instance = JiebaRs::new(); + Arc::new(instance) + }) + .await; + } + + fn get_instance() -> Result> { + GLOBAL_JIEBA + .get() + .cloned() + .context("JiebaRs is not initialized. Please call init_global() first.") + } + + pub fn cut(text: String, hmm: bool) -> Result> { + let jieba = Self::get_instance()?; + Ok(jieba + .inner + .cut(&text, hmm) + .iter() + .map(|s| s.to_string()) + .collect()) + } + + pub fn cut_all(text: String) -> Result> { + let jieba = Self::get_instance()?; + let result: HashSet = jieba + .inner + .cut_all(&text) + .iter() + .map(|s| s.to_string()) + .collect(); + Ok(result.into_iter().collect()) + } + + pub fn cut_for_search(text: String, hmm: bool) -> Result> { + let jieba = Self::get_instance()?; + let result: HashSet = jieba + .inner + .cut_for_search(&text, hmm) + .iter() + .map(|s| s.to_string()) + .collect(); + Ok(result.into_iter().collect()) + } + + pub fn extract_keywords_tfidf( + text: String, + top_k: usize, + allowed_pos: Vec, + ) -> Result> { + let jieba = Self::get_instance()?; + let tfidf = jieba + .tfidf + .get_or_try_init(|| Ok(TfIdf::default())) + .context("Failed to initialize TF-IDF")?; + + let keywords = tfidf.extract_keywords(&jieba.inner, &text, top_k, allowed_pos); + Ok(Self::convert_keywords(keywords)) + } + + pub fn extract_keywords_text_rank( + text: String, + top_k: usize, + allowed_pos: Vec, + ) -> Result> { + let jieba = Self::get_instance()?; + let text_rank = jieba + .text_rank + .get_or_try_init(|| Ok(TextRank::default())) + .context("Failed to initialize TextRank")?; + + let keywords = text_rank.extract_keywords(&jieba.inner, &text, top_k, allowed_pos); + Ok(Self::convert_keywords(keywords)) + } + + fn convert_keywords(keywords: Vec) -> Vec { + keywords + .into_iter() + .map(|k| Keyword { + keyword: k.keyword, + weight: k.weight, + }) + .collect() + } +} diff --git a/rust/src/api/mod.rs b/rust/src/api/mod.rs index 3361cfc..c40cb50 100644 --- a/rust/src/api/mod.rs +++ b/rust/src/api/mod.rs @@ -3,4 +3,5 @@ pub mod constants; pub mod kmp; pub mod font; pub mod aes; -pub mod zip; \ No newline at end of file +pub mod zip; +pub mod jieba; \ No newline at end of file diff --git a/rust/src/frb_generated.rs b/rust/src/frb_generated.rs index c41070b..a34deec 100644 --- a/rust/src/frb_generated.rs +++ b/rust/src/frb_generated.rs @@ -28,12 +28,13 @@ use crate::api::aes::*; use crate::api::compress::*; use crate::api::font::*; +use crate::api::jieba::*; use crate::api::kmp::*; use crate::api::zip::*; use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt}; use flutter_rust_bridge::for_generated::{transform_result_dco, Lifetimeable, Lockable}; use flutter_rust_bridge::{Handler, IntoIntoDart}; -use image::DynamicImage; + // Section: boilerplate flutter_rust_bridge::frb_generated_boilerplate!( @@ -42,7 +43,7 @@ flutter_rust_bridge::frb_generated_boilerplate!( default_rust_auto_opaque = RustAutoOpaqueMoi, ); pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.9.0"; -pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 199828844; +pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 1525123801; // Section: executor @@ -284,6 +285,390 @@ fn wire__crate__api__compress__ImageCompress_contain_with_options_impl( }, ) } +fn wire__crate__api__jieba__JiebaRs_cut_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "JiebaRs_cut", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_text = ::sse_decode(&mut deserializer); + let api_hmm = ::sse_decode(&mut deserializer); + deserializer.end(); + move |context| { + transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( + (move || { + let output_ok = crate::api::jieba::JiebaRs::cut(api_text, api_hmm)?; + Ok(output_ok) + })(), + ) + } + }, + ) +} +fn wire__crate__api__jieba__JiebaRs_cut_all_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "JiebaRs_cut_all", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_text = ::sse_decode(&mut deserializer); + deserializer.end(); + move |context| { + transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( + (move || { + let output_ok = crate::api::jieba::JiebaRs::cut_all(api_text)?; + Ok(output_ok) + })(), + ) + } + }, + ) +} +fn wire__crate__api__jieba__JiebaRs_cut_for_search_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "JiebaRs_cut_for_search", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_text = ::sse_decode(&mut deserializer); + let api_hmm = ::sse_decode(&mut deserializer); + deserializer.end(); + move |context| { + transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( + (move || { + let output_ok = + crate::api::jieba::JiebaRs::cut_for_search(api_text, api_hmm)?; + Ok(output_ok) + })(), + ) + } + }, + ) +} +fn wire__crate__api__jieba__JiebaRs_extract_keywords_text_rank_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "JiebaRs_extract_keywords_text_rank", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_text = ::sse_decode(&mut deserializer); + let api_top_k = ::sse_decode(&mut deserializer); + let api_allowed_pos = >::sse_decode(&mut deserializer); + deserializer.end(); + move |context| { + transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( + (move || { + let output_ok = crate::api::jieba::JiebaRs::extract_keywords_text_rank( + api_text, + api_top_k, + api_allowed_pos, + )?; + Ok(output_ok) + })(), + ) + } + }, + ) +} +fn wire__crate__api__jieba__JiebaRs_extract_keywords_tfidf_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "JiebaRs_extract_keywords_tfidf", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_text = ::sse_decode(&mut deserializer); + let api_top_k = ::sse_decode(&mut deserializer); + let api_allowed_pos = >::sse_decode(&mut deserializer); + deserializer.end(); + move |context| { + transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( + (move || { + let output_ok = crate::api::jieba::JiebaRs::extract_keywords_tfidf( + api_text, + api_top_k, + api_allowed_pos, + )?; + Ok(output_ok) + })(), + ) + } + }, + ) +} +fn wire__crate__api__jieba__Keyword_auto_accessor_get_keyword_impl( + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "Keyword_auto_accessor_get_keyword", + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + deserializer.end(); + transform_result_sse::<_, ()>((move || { + let mut api_that_guard = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order(vec![ + flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + ), + ]); + for i in decode_indices_ { + match i { + 0 => api_that_guard = Some(api_that.lockable_decode_sync_ref()), + _ => unreachable!(), + } + } + let api_that_guard = api_that_guard.unwrap(); + let output_ok = Result::<_, ()>::Ok(api_that_guard.keyword.clone())?; + Ok(output_ok) + })()) + }, + ) +} +fn wire__crate__api__jieba__Keyword_auto_accessor_get_weight_impl( + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "Keyword_auto_accessor_get_weight", + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + deserializer.end(); + transform_result_sse::<_, ()>((move || { + let mut api_that_guard = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order(vec![ + flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + ), + ]); + for i in decode_indices_ { + match i { + 0 => api_that_guard = Some(api_that.lockable_decode_sync_ref()), + _ => unreachable!(), + } + } + let api_that_guard = api_that_guard.unwrap(); + let output_ok = Result::<_, ()>::Ok(api_that_guard.weight.clone())?; + Ok(output_ok) + })()) + }, + ) +} +fn wire__crate__api__jieba__Keyword_auto_accessor_set_keyword_impl( + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "Keyword_auto_accessor_set_keyword", + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + let api_keyword = ::sse_decode(&mut deserializer); + deserializer.end(); + transform_result_sse::<_, ()>((move || { + let mut api_that_guard = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order(vec![ + flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, true, + ), + ]); + for i in decode_indices_ { + match i { + 0 => api_that_guard = Some(api_that.lockable_decode_sync_ref_mut()), + _ => unreachable!(), + } + } + let mut api_that_guard = api_that_guard.unwrap(); + let output_ok = Result::<_, ()>::Ok({ + { + api_that_guard.keyword = api_keyword; + }; + })?; + Ok(output_ok) + })()) + }, + ) +} +fn wire__crate__api__jieba__Keyword_auto_accessor_set_weight_impl( + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "Keyword_auto_accessor_set_weight", + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_that = , + >>::sse_decode(&mut deserializer); + let api_weight = ::sse_decode(&mut deserializer); + deserializer.end(); + transform_result_sse::<_, ()>((move || { + let mut api_that_guard = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order(vec![ + flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, true, + ), + ]); + for i in decode_indices_ { + match i { + 0 => api_that_guard = Some(api_that.lockable_decode_sync_ref_mut()), + _ => unreachable!(), + } + } + let mut api_that_guard = api_that_guard.unwrap(); + let output_ok = Result::<_, ()>::Ok({ + { + api_that_guard.weight = api_weight; + }; + })?; + Ok(output_ok) + })()) + }, + ) +} fn wire__crate__api__kmp__Kmp_find_matches_impl( port_: flutter_rust_bridge::for_generated::MessagePort, ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, @@ -635,15 +1020,15 @@ fn wire__crate__api__kmp__build_prefix_table_impl( }, ) } -fn wire__crate__api__compress__compress_impl( +fn wire__crate__api__jieba__init_jieba_impl( port_: flutter_rust_bridge::for_generated::MessagePort, ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, rust_vec_len_: i32, data_len_: i32, ) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( flutter_rust_bridge::for_generated::TaskInfo { - debug_name: "compress", + debug_name: "init_jieba", port: Some(port_), mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, }, @@ -657,41 +1042,16 @@ fn wire__crate__api__compress__compress_impl( }; let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); - let api_img = , - >>::sse_decode(&mut deserializer); - let api_dst_height = ::sse_decode(&mut deserializer); - let api_dst_width = ::sse_decode(&mut deserializer); - let api_compress_format = - ::sse_decode(&mut deserializer); - let api_quality = ::sse_decode(&mut deserializer); deserializer.end(); - move |context| { - transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( - (move || { - let mut api_img_guard = None; - let decode_indices_ = - flutter_rust_bridge::for_generated::lockable_compute_decode_order( - vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( - &api_img, 0, false, - )], - ); - for i in decode_indices_ { - match i { - 0 => api_img_guard = Some(api_img.lockable_decode_sync_ref()), - _ => unreachable!(), - } - } - let api_img_guard = api_img_guard.unwrap(); - let output_ok = crate::api::compress::compress( - &*api_img_guard, - api_dst_height, - api_dst_width, - api_compress_format, - api_quality, - )?; + move |context| async move { + transform_result_sse::<_, ()>( + (move || async move { + let output_ok = Result::<_, ()>::Ok({ + crate::api::jieba::init_jieba().await; + })?; Ok(output_ok) - })(), + })() + .await, ) } }, @@ -738,15 +1098,18 @@ fn wire__crate__api__kmp__kmp_search_impl( flutter_rust_bridge::frb_generated_moi_arc_impl_value!( flutter_rust_bridge::for_generated::RustAutoOpaqueInner ); -flutter_rust_bridge::frb_generated_moi_arc_impl_value!( - flutter_rust_bridge::for_generated::RustAutoOpaqueInner -); flutter_rust_bridge::frb_generated_moi_arc_impl_value!( flutter_rust_bridge::for_generated::RustAutoOpaqueInner ); flutter_rust_bridge::frb_generated_moi_arc_impl_value!( flutter_rust_bridge::for_generated::RustAutoOpaqueInner ); +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); flutter_rust_bridge::frb_generated_moi_arc_impl_value!( flutter_rust_bridge::for_generated::RustAutoOpaqueInner ); @@ -794,6 +1157,26 @@ impl SseDecode for ImageCompress { } } +impl SseDecode for JiebaRs { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + +impl SseDecode for Keyword { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + impl SseDecode for Kmp { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -844,16 +1227,6 @@ impl SseDecode } } -impl SseDecode - for RustOpaqueMoi> -{ - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { - let mut inner = ::sse_decode(deserializer); - return decode_rust_opaque_moi(inner); - } -} - impl SseDecode for RustOpaqueMoi> { @@ -874,6 +1247,22 @@ impl SseDecode } } +impl SseDecode for RustOpaqueMoi> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + +impl SseDecode for RustOpaqueMoi> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + impl SseDecode for RustOpaqueMoi> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -898,6 +1287,13 @@ impl SseDecode for String { } } +impl SseDecode for bool { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + deserializer.cursor.read_u8().unwrap() != 0 + } +} + impl SseDecode for crate::api::constants::CompressFormat { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -918,6 +1314,13 @@ impl SseDecode for f32 { } } +impl SseDecode for f64 { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + deserializer.cursor.read_f64::().unwrap() + } +} + impl SseDecode for i32 { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -925,6 +1328,18 @@ impl SseDecode for i32 { } } +impl SseDecode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = vec![]; + for idx_ in 0..len_ { + ans_.push(::sse_decode(deserializer)); + } + return ans_; + } +} + impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -1087,13 +1502,6 @@ impl SseDecode for usize { } } -impl SseDecode for bool { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { - deserializer.cursor.read_u8().unwrap() != 0 - } -} - fn pde_ffi_dispatcher_primary_impl( func_id: i32, port: flutter_rust_bridge::for_generated::MessagePort, @@ -1126,15 +1534,32 @@ fn pde_ffi_dispatcher_primary_impl( rust_vec_len, data_len, ), - 7 => wire__crate__api__kmp__Kmp_find_matches_impl(port, ptr, rust_vec_len, data_len), - 8 => wire__crate__api__kmp__Kmp_replace_with_kmp_impl(port, ptr, rust_vec_len, data_len), - 9 => wire__crate__api__zip__Zip_add_dir_impl(port, ptr, rust_vec_len, data_len), - 10 => wire__crate__api__zip__Zip_add_file_impl(port, ptr, rust_vec_len, data_len), - 11 => wire__crate__api__zip__Zip_extract_impl(port, ptr, rust_vec_len, data_len), - 12 => wire__crate__api__zip__Zip_finish_impl(port, ptr, rust_vec_len, data_len), - 14 => wire__crate__api__kmp__build_prefix_table_impl(port, ptr, rust_vec_len, data_len), - 15 => wire__crate__api__compress__compress_impl(port, ptr, rust_vec_len, data_len), - 16 => wire__crate__api__kmp__kmp_search_impl(port, ptr, rust_vec_len, data_len), + 7 => wire__crate__api__jieba__JiebaRs_cut_impl(port, ptr, rust_vec_len, data_len), + 8 => wire__crate__api__jieba__JiebaRs_cut_all_impl(port, ptr, rust_vec_len, data_len), + 9 => { + wire__crate__api__jieba__JiebaRs_cut_for_search_impl(port, ptr, rust_vec_len, data_len) + } + 10 => wire__crate__api__jieba__JiebaRs_extract_keywords_text_rank_impl( + port, + ptr, + rust_vec_len, + data_len, + ), + 11 => wire__crate__api__jieba__JiebaRs_extract_keywords_tfidf_impl( + port, + ptr, + rust_vec_len, + data_len, + ), + 16 => wire__crate__api__kmp__Kmp_find_matches_impl(port, ptr, rust_vec_len, data_len), + 17 => wire__crate__api__kmp__Kmp_replace_with_kmp_impl(port, ptr, rust_vec_len, data_len), + 18 => wire__crate__api__zip__Zip_add_dir_impl(port, ptr, rust_vec_len, data_len), + 19 => wire__crate__api__zip__Zip_add_file_impl(port, ptr, rust_vec_len, data_len), + 20 => wire__crate__api__zip__Zip_extract_impl(port, ptr, rust_vec_len, data_len), + 21 => wire__crate__api__zip__Zip_finish_impl(port, ptr, rust_vec_len, data_len), + 23 => wire__crate__api__kmp__build_prefix_table_impl(port, ptr, rust_vec_len, data_len), + 24 => wire__crate__api__jieba__init_jieba_impl(port, ptr, rust_vec_len, data_len), + 25 => wire__crate__api__kmp__kmp_search_impl(port, ptr, rust_vec_len, data_len), _ => unreachable!(), } } @@ -1147,7 +1572,27 @@ fn pde_ffi_dispatcher_sync_impl( ) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { // Codec=Pde (Serialization + dispatch), see doc to use other codecs match func_id { - 13 => wire__crate__api__zip__Zip_new_impl(ptr, rust_vec_len, data_len), + 12 => wire__crate__api__jieba__Keyword_auto_accessor_get_keyword_impl( + ptr, + rust_vec_len, + data_len, + ), + 13 => wire__crate__api__jieba__Keyword_auto_accessor_get_weight_impl( + ptr, + rust_vec_len, + data_len, + ), + 14 => wire__crate__api__jieba__Keyword_auto_accessor_set_keyword_impl( + ptr, + rust_vec_len, + data_len, + ), + 15 => wire__crate__api__jieba__Keyword_auto_accessor_set_weight_impl( + ptr, + rust_vec_len, + data_len, + ), + 22 => wire__crate__api__zip__Zip_new_impl(ptr, rust_vec_len, data_len), _ => unreachable!(), } } @@ -1199,6 +1644,36 @@ impl flutter_rust_bridge::IntoIntoDart> for ImageCompr } } +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for FrbWrapper {} + +impl flutter_rust_bridge::IntoIntoDart> for JiebaRs { + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for FrbWrapper {} + +impl flutter_rust_bridge::IntoIntoDart> for Keyword { + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + // Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for FrbWrapper { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { @@ -1280,6 +1755,20 @@ impl SseEncode for ImageCompress { } } +impl SseEncode for JiebaRs { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), serializer); + } +} + +impl SseEncode for Keyword { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), serializer); + } +} + impl SseEncode for Kmp { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -1332,17 +1821,6 @@ impl SseEncode } } -impl SseEncode - for RustOpaqueMoi> -{ - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - let (ptr, size) = self.sse_encode_raw(); - ::sse_encode(ptr, serializer); - ::sse_encode(size, serializer); - } -} - impl SseEncode for RustOpaqueMoi> { @@ -1365,6 +1843,24 @@ impl SseEncode } } +impl SseEncode for RustOpaqueMoi> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + +impl SseEncode for RustOpaqueMoi> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + impl SseEncode for RustOpaqueMoi> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -1390,6 +1886,13 @@ impl SseEncode for String { } } +impl SseEncode for bool { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + serializer.cursor.write_u8(self as _).unwrap(); + } +} + impl SseEncode for crate::api::constants::CompressFormat { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -1414,6 +1917,13 @@ impl SseEncode for f32 { } } +impl SseEncode for f64 { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + serializer.cursor.write_f64::(self).unwrap(); + } +} + impl SseEncode for i32 { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -1421,6 +1931,16 @@ impl SseEncode for i32 { } } +impl SseEncode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + ::sse_encode(item, serializer); + } + } +} + impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -1566,13 +2086,6 @@ impl SseEncode for usize { } } -impl SseEncode for bool { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - serializer.cursor.write_u8(self as _).unwrap(); - } -} - #[cfg(not(target_family = "wasm"))] mod io { // This file is automatically generated, so please do not edit it. @@ -1584,6 +2097,7 @@ mod io { use crate::api::aes::*; use crate::api::compress::*; use crate::api::font::*; + use crate::api::jieba::*; use crate::api::kmp::*; use crate::api::zip::*; use flutter_rust_bridge::for_generated::byteorder::{ @@ -1610,20 +2124,6 @@ mod io { MoiArc::>::decrement_strong_count(ptr as _); } - #[unsafe(no_mangle)] - pub extern "C" fn frbgen_moodiary_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::increment_strong_count(ptr as _); - } - - #[unsafe(no_mangle)] - pub extern "C" fn frbgen_moodiary_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::decrement_strong_count(ptr as _); - } - #[unsafe(no_mangle)] pub extern "C" fn frbgen_moodiary_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( ptr: *const std::ffi::c_void, @@ -1652,6 +2152,34 @@ mod io { MoiArc::>::decrement_strong_count(ptr as _); } + #[unsafe(no_mangle)] + pub extern "C" fn frbgen_moodiary_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + ptr: *const std::ffi::c_void, + ) { + MoiArc::>::increment_strong_count(ptr as _); + } + + #[unsafe(no_mangle)] + pub extern "C" fn frbgen_moodiary_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerJiebaRs( + ptr: *const std::ffi::c_void, + ) { + MoiArc::>::decrement_strong_count(ptr as _); + } + + #[unsafe(no_mangle)] + pub extern "C" fn frbgen_moodiary_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + ptr: *const std::ffi::c_void, + ) { + MoiArc::>::increment_strong_count(ptr as _); + } + + #[unsafe(no_mangle)] + pub extern "C" fn frbgen_moodiary_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKeyword( + ptr: *const std::ffi::c_void, + ) { + MoiArc::>::decrement_strong_count(ptr as _); + } + #[unsafe(no_mangle)] pub extern "C" fn frbgen_moodiary_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( ptr: *const std::ffi::c_void, @@ -1682,116 +2210,3 @@ mod io { } #[cfg(not(target_family = "wasm"))] pub use io::*; - -/// cbindgen:ignore -#[cfg(target_family = "wasm")] -mod web { - // This file is automatically generated, so please do not edit it. - // @generated by `flutter_rust_bridge`@ 2.9.0. - - // Section: imports - - use super::*; - use crate::api::aes::*; - use crate::api::compress::*; - use crate::api::font::*; - use crate::api::kmp::*; - use crate::api::zip::*; - use flutter_rust_bridge::for_generated::byteorder::{ - NativeEndian, ReadBytesExt, WriteBytesExt, - }; - use flutter_rust_bridge::for_generated::wasm_bindgen; - use flutter_rust_bridge::for_generated::wasm_bindgen::prelude::*; - use flutter_rust_bridge::for_generated::{transform_result_dco, Lifetimeable, Lockable}; - use flutter_rust_bridge::{Handler, IntoIntoDart}; - - // Section: boilerplate - - flutter_rust_bridge::frb_generated_boilerplate_web!(); - - #[wasm_bindgen] - pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::increment_strong_count(ptr as _); - } - - #[wasm_bindgen] - pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerAesEncryption( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::decrement_strong_count(ptr as _); - } - - #[wasm_bindgen] - pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::increment_strong_count(ptr as _); - } - - #[wasm_bindgen] - pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDynamicImage( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::decrement_strong_count(ptr as _); - } - - #[wasm_bindgen] - pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::increment_strong_count(ptr as _); - } - - #[wasm_bindgen] - pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerFontReader( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::decrement_strong_count(ptr as _); - } - - #[wasm_bindgen] - pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::increment_strong_count(ptr as _); - } - - #[wasm_bindgen] - pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerImageCompress( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::decrement_strong_count(ptr as _); - } - - #[wasm_bindgen] - pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::increment_strong_count(ptr as _); - } - - #[wasm_bindgen] - pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerKmp( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::decrement_strong_count(ptr as _); - } - - #[wasm_bindgen] - pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::increment_strong_count(ptr as _); - } - - #[wasm_bindgen] - pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerZip( - ptr: *const std::ffi::c_void, - ) { - MoiArc::>::decrement_strong_count(ptr as _); - } -} -#[cfg(target_family = "wasm")] -pub use web::*; From 2e206a93354ab89be53e3ca9541d3ab130d8c61e Mon Sep 17 00:00:00 2001 From: ZhuJHua <1624109111@qq.com> Date: Fri, 18 Apr 2025 11:54:16 +0800 Subject: [PATCH 2/3] fix: qweather api error --- build.yaml | 19 + lib/api/api.dart | 16 +- lib/common/models/geo.dart | 138 +- lib/common/models/geo.freezed.dart | 768 ++++++++ lib/common/models/geo.g.dart | 70 + lib/common/models/github.dart | 422 +---- lib/common/models/github.freezed.dart | 1997 ++++++++++++++++++++ lib/common/models/github.g.dart | 183 ++ lib/common/models/hitokoto.dart | 78 +- lib/common/models/hitokoto.freezed.dart | 370 ++++ lib/common/models/hitokoto.g.dart | 39 + lib/common/models/hunyuan.dart | 175 +- lib/common/models/hunyuan.freezed.dart | 1250 ++++++++++++ lib/common/models/hunyuan.g.dart | 88 + lib/common/models/image.dart | 160 +- lib/common/models/image.freezed.dart | 825 ++++++++ lib/common/models/image.g.dart | 76 + lib/common/models/weather.dart | 164 +- lib/common/models/weather.freezed.dart | 861 +++++++++ lib/common/models/weather.g.dart | 79 + lib/l10n/app_localizations.dart | 37 +- lib/l10n/app_localizations_en.dart | 61 +- lib/l10n/app_localizations_zh.dart | 13 +- lib/pages/analyse/analyse_logic.dart | 9 +- lib/pages/assistant/assistant_logic.dart | 11 +- lib/pages/edit/edit_logic.dart | 70 +- lib/pages/laboratory/laboratory_logic.dart | 11 + lib/pages/laboratory/laboratory_view.dart | 15 + lib/persistence/pref.dart | 2 + lib/utils/http_util.dart | 5 +- lib/utils/notice_util.dart | 2 +- 31 files changed, 7040 insertions(+), 974 deletions(-) create mode 100644 build.yaml create mode 100644 lib/common/models/geo.freezed.dart create mode 100644 lib/common/models/geo.g.dart create mode 100644 lib/common/models/github.freezed.dart create mode 100644 lib/common/models/github.g.dart create mode 100644 lib/common/models/hitokoto.freezed.dart create mode 100644 lib/common/models/hitokoto.g.dart create mode 100644 lib/common/models/hunyuan.freezed.dart create mode 100644 lib/common/models/hunyuan.g.dart create mode 100644 lib/common/models/image.freezed.dart create mode 100644 lib/common/models/image.g.dart create mode 100644 lib/common/models/weather.freezed.dart create mode 100644 lib/common/models/weather.g.dart diff --git a/build.yaml b/build.yaml new file mode 100644 index 0000000..8093126 --- /dev/null +++ b/build.yaml @@ -0,0 +1,19 @@ +targets: + $default: + builders: + json_serializable: + options: + any_map: false + checked: false + constructor: "" + create_factory: true + create_field_map: false + create_json_keys: false + create_per_field_to_json: false + create_to_json: true + disallow_unrecognized_keys: false + explicit_to_json: false + field_rename: none + generic_argument_factories: false + ignore_unannotated: false + include_if_null: false \ No newline at end of file diff --git a/lib/api/api.dart b/lib/api/api.dart index 69f74fe..a3daea2 100644 --- a/lib/api/api.dart +++ b/lib/api/api.dart @@ -36,7 +36,7 @@ class Api { //请求正文 final body = { 'Model': hunyuanModel, - 'Messages': messages.map((value) => value.toMap()).toList(), + 'Messages': messages.map((value) => value.toJson()).toList(), 'Stream': true, }; @@ -49,15 +49,15 @@ class Api { ); //构造请求头 final header = PublicHeader( - 'ChatCompletions', - timestamp ~/ 1000, - '2023-09-01', - authorization, + action: 'ChatCompletions', + timestamp: timestamp ~/ 1000, + version: '2023-09-01', + authorization: authorization, ); //发起请求 return await HttpUtil().postStream( 'https://hunyuan.tencentcloudapi.com', - header: header.toMap(), + header: header.toJson(), data: body, ); } @@ -97,7 +97,7 @@ class Api { 'lang': local, }; final res = await HttpUtil().get( - 'https://geoapi.qweather.com/v2/city/lookup', + 'https://${PrefUtil.getValue('qweatherApiHost')}/geo/v2/city/lookup', parameters: parameters, ); final geo = await compute( @@ -131,7 +131,7 @@ class Api { 'lang': local, }; final res = await HttpUtil().get( - 'https://devapi.qweather.com/v7/weather/now', + 'https://${PrefUtil.getValue('qweatherApiHost')}/v7/weather/now', parameters: parameters, ); final weather = await compute( diff --git a/lib/common/models/geo.dart b/lib/common/models/geo.dart index 70078bd..9f1a1e1 100644 --- a/lib/common/models/geo.dart +++ b/lib/common/models/geo.dart @@ -1,113 +1,45 @@ -class GeoResponse { - String? code; - List? location; - Refer? refer; +import 'package:freezed_annotation/freezed_annotation.dart'; - GeoResponse({this.code, this.location, this.refer}); +part 'geo.freezed.dart'; +part 'geo.g.dart'; - GeoResponse.fromJson(Map json) { - code = json["code"]; - location = - json["location"] == null - ? null - : (json["location"] as List) - .map((e) => Location.fromJson(e)) - .toList(); - refer = json["refer"] == null ? null : Refer.fromJson(json["refer"]); - } +@freezed +abstract class GeoResponse with _$GeoResponse { + const factory GeoResponse({ + String? code, + List? location, + Refer? refer, + }) = _GeoResponse; - Map toJson() { - final Map data = {}; - data["code"] = code; - data["location"] = location?.map((e) => e.toJson()).toList(); - data["refer"] = refer?.toJson(); - return data; - } + factory GeoResponse.fromJson(Map json) => + _$GeoResponseFromJson(json); } -class Refer { - List? sources; - List? license; +@freezed +abstract class Refer with _$Refer { + const factory Refer({List? sources, List? license}) = _Refer; - Refer({this.sources, this.license}); - - Refer.fromJson(Map json) { - sources = - json["sources"] == null ? null : List.from(json["sources"]); - license = - json["license"] == null ? null : List.from(json["license"]); - } - - Map toJson() { - final Map data = {}; - data["sources"] = sources; - data["license"] = license; - return data; - } + factory Refer.fromJson(Map json) => _$ReferFromJson(json); } -class Location { - String? name; - String? id; - String? lat; - String? lon; - String? adm2; - String? adm1; - String? country; - String? tz; - String? utcOffset; - String? isDst; - String? type; - String? rank; - String? fxLink; +@freezed +abstract class Location with _$Location { + const factory Location({ + String? name, + String? id, + String? lat, + String? lon, + String? adm2, + String? adm1, + String? country, + String? tz, + String? utcOffset, + String? isDst, + String? type, + String? rank, + String? fxLink, + }) = _Location; - Location({ - this.name, - this.id, - this.lat, - this.lon, - this.adm2, - this.adm1, - this.country, - this.tz, - this.utcOffset, - this.isDst, - this.type, - this.rank, - this.fxLink, - }); - - Location.fromJson(Map json) { - name = json["name"]; - id = json["id"]; - lat = json["lat"]; - lon = json["lon"]; - adm2 = json["adm2"]; - adm1 = json["adm1"]; - country = json["country"]; - tz = json["tz"]; - utcOffset = json["utcOffset"]; - isDst = json["isDst"]; - type = json["type"]; - rank = json["rank"]; - fxLink = json["fxLink"]; - } - - Map toJson() { - final Map data = {}; - data["name"] = name; - data["id"] = id; - data["lat"] = lat; - data["lon"] = lon; - data["adm2"] = adm2; - data["adm1"] = adm1; - data["country"] = country; - data["tz"] = tz; - data["utcOffset"] = utcOffset; - data["isDst"] = isDst; - data["type"] = type; - data["rank"] = rank; - data["fxLink"] = fxLink; - return data; - } + factory Location.fromJson(Map json) => + _$LocationFromJson(json); } diff --git a/lib/common/models/geo.freezed.dart b/lib/common/models/geo.freezed.dart new file mode 100644 index 0000000..7d25248 --- /dev/null +++ b/lib/common/models/geo.freezed.dart @@ -0,0 +1,768 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'geo.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$GeoResponse { + + String? get code; + + List? get location; + + Refer? get refer; + + /// Create a copy of GeoResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GeoResponseCopyWith get copyWith => + _$GeoResponseCopyWithImpl(this as GeoResponse, _$identity); + + /// Serializes this GeoResponse to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is GeoResponse && + (identical(other.code, code) || other.code == code) && + const DeepCollectionEquality().equals(other.location, location) && + (identical(other.refer, refer) || other.refer == refer)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, code, const DeepCollectionEquality().hash(location), refer); + + @override + String toString() { + return 'GeoResponse(code: $code, location: $location, refer: $refer)'; + } + + +} + +/// @nodoc +abstract mixin class $GeoResponseCopyWith<$Res> { + factory $GeoResponseCopyWith(GeoResponse value, + $Res Function(GeoResponse) _then) = _$GeoResponseCopyWithImpl; + + @useResult + $Res call({ + String? code, List? location, Refer? refer + }); + + + $ReferCopyWith<$Res>? get refer; + +} + +/// @nodoc +class _$GeoResponseCopyWithImpl<$Res> + implements $GeoResponseCopyWith<$Res> { + _$GeoResponseCopyWithImpl(this._self, this._then); + + final GeoResponse _self; + final $Res Function(GeoResponse) _then; + + /// Create a copy of GeoResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? code = freezed, Object? location = freezed, Object? refer = freezed,}) { + return _then(_self.copyWith( + code: freezed == code + ? _self.code + : code // ignore: cast_nullable_to_non_nullable + as String?, + location: freezed == location + ? _self.location + : location // ignore: cast_nullable_to_non_nullable + as List?, + refer: freezed == refer + ? _self.refer + : refer // ignore: cast_nullable_to_non_nullable + as Refer?, + )); + } + + /// Create a copy of GeoResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ReferCopyWith<$Res>? get refer { + if (_self.refer == null) { + return null; + } + + return $ReferCopyWith<$Res>(_self.refer!, (value) { + return _then(_self.copyWith(refer: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _GeoResponse implements GeoResponse { + const _GeoResponse({this.code, final List? location, this.refer}) + : _location = location; + + factory _GeoResponse.fromJson(Map json) => + _$GeoResponseFromJson(json); + + @override final String? code; + final List? _location; + + @override List? get location { + final value = _location; + if (value == null) return null; + if (_location is EqualUnmodifiableListView) return _location; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override final Refer? refer; + + /// Create a copy of GeoResponse + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$GeoResponseCopyWith<_GeoResponse> get copyWith => + __$GeoResponseCopyWithImpl<_GeoResponse>(this, _$identity); + + @override + Map toJson() { + return _$GeoResponseToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _GeoResponse && + (identical(other.code, code) || other.code == code) && + const DeepCollectionEquality().equals(other._location, _location) && + (identical(other.refer, refer) || other.refer == refer)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, code, const DeepCollectionEquality().hash(_location), refer); + + @override + String toString() { + return 'GeoResponse(code: $code, location: $location, refer: $refer)'; + } + + +} + +/// @nodoc +abstract mixin class _$GeoResponseCopyWith<$Res> + implements $GeoResponseCopyWith<$Res> { + factory _$GeoResponseCopyWith(_GeoResponse value, + $Res Function(_GeoResponse) _then) = __$GeoResponseCopyWithImpl; + + @override + @useResult + $Res call({ + String? code, List? location, Refer? refer + }); + + + @override $ReferCopyWith<$Res>? get refer; + +} + +/// @nodoc +class __$GeoResponseCopyWithImpl<$Res> + implements _$GeoResponseCopyWith<$Res> { + __$GeoResponseCopyWithImpl(this._self, this._then); + + final _GeoResponse _self; + final $Res Function(_GeoResponse) _then; + + /// Create a copy of GeoResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? code = freezed, Object? location = freezed, Object? refer = freezed,}) { + return _then(_GeoResponse( + code: freezed == code + ? _self.code + : code // ignore: cast_nullable_to_non_nullable + as String?, + location: freezed == location + ? _self._location + : location // ignore: cast_nullable_to_non_nullable + as List?, + refer: freezed == refer + ? _self.refer + : refer // ignore: cast_nullable_to_non_nullable + as Refer?, + )); + } + + /// Create a copy of GeoResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ReferCopyWith<$Res>? get refer { + if (_self.refer == null) { + return null; + } + + return $ReferCopyWith<$Res>(_self.refer!, (value) { + return _then(_self.copyWith(refer: value)); + }); + } +} + + +/// @nodoc +mixin _$Refer { + + List? get sources; + + List? get license; + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReferCopyWith get copyWith => + _$ReferCopyWithImpl(this as Refer, _$identity); + + /// Serializes this Refer to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Refer && + const DeepCollectionEquality().equals(other.sources, sources) && + const DeepCollectionEquality().equals(other.license, license)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, const DeepCollectionEquality().hash(sources), + const DeepCollectionEquality().hash(license)); + + @override + String toString() { + return 'Refer(sources: $sources, license: $license)'; + } + + +} + +/// @nodoc +abstract mixin class $ReferCopyWith<$Res> { + factory $ReferCopyWith(Refer value, + $Res Function(Refer) _then) = _$ReferCopyWithImpl; + + @useResult + $Res call({ + List? sources, List? license + }); + + +} + +/// @nodoc +class _$ReferCopyWithImpl<$Res> + implements $ReferCopyWith<$Res> { + _$ReferCopyWithImpl(this._self, this._then); + + final Refer _self; + final $Res Function(Refer) _then; + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? sources = freezed, Object? license = freezed,}) { + return _then(_self.copyWith( + sources: freezed == sources + ? _self.sources + : sources // ignore: cast_nullable_to_non_nullable + as List?, + license: freezed == license + ? _self.license + : license // ignore: cast_nullable_to_non_nullable + as List?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Refer implements Refer { + const _Refer({final List? sources, final List? license}) + : _sources = sources, + _license = license; + + factory _Refer.fromJson(Map json) => _$ReferFromJson(json); + + final List? _sources; + + @override List? get sources { + final value = _sources; + if (value == null) return null; + if (_sources is EqualUnmodifiableListView) return _sources; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + final List? _license; + + @override List? get license { + final value = _license; + if (value == null) return null; + if (_license is EqualUnmodifiableListView) return _license; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ReferCopyWith<_Refer> get copyWith => + __$ReferCopyWithImpl<_Refer>(this, _$identity); + + @override + Map toJson() { + return _$ReferToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Refer && + const DeepCollectionEquality().equals(other._sources, _sources) && + const DeepCollectionEquality().equals(other._license, _license)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, const DeepCollectionEquality().hash(_sources), + const DeepCollectionEquality().hash(_license)); + + @override + String toString() { + return 'Refer(sources: $sources, license: $license)'; + } + + +} + +/// @nodoc +abstract mixin class _$ReferCopyWith<$Res> implements $ReferCopyWith<$Res> { + factory _$ReferCopyWith(_Refer value, + $Res Function(_Refer) _then) = __$ReferCopyWithImpl; + + @override + @useResult + $Res call({ + List? sources, List? license + }); + + +} + +/// @nodoc +class __$ReferCopyWithImpl<$Res> + implements _$ReferCopyWith<$Res> { + __$ReferCopyWithImpl(this._self, this._then); + + final _Refer _self; + final $Res Function(_Refer) _then; + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({Object? sources = freezed, Object? license = freezed,}) { + return _then(_Refer( + sources: freezed == sources + ? _self._sources + : sources // ignore: cast_nullable_to_non_nullable + as List?, + license: freezed == license + ? _self._license + : license // ignore: cast_nullable_to_non_nullable + as List?, + )); + } + + +} + + +/// @nodoc +mixin _$Location { + + String? get name; + + String? get id; + + String? get lat; + + String? get lon; + + String? get adm2; + + String? get adm1; + + String? get country; + + String? get tz; + + String? get utcOffset; + + String? get isDst; + + String? get type; + + String? get rank; + + String? get fxLink; + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $LocationCopyWith get copyWith => + _$LocationCopyWithImpl(this as Location, _$identity); + + /// Serializes this Location to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Location && + (identical(other.name, name) || other.name == name) && + (identical(other.id, id) || other.id == id) && + (identical(other.lat, lat) || other.lat == lat) && + (identical(other.lon, lon) || other.lon == lon) && + (identical(other.adm2, adm2) || other.adm2 == adm2) && + (identical(other.adm1, adm1) || other.adm1 == adm1) && + (identical(other.country, country) || other.country == country) && + (identical(other.tz, tz) || other.tz == tz) && + (identical(other.utcOffset, utcOffset) || + other.utcOffset == utcOffset) && + (identical(other.isDst, isDst) || other.isDst == isDst) && + (identical(other.type, type) || other.type == type) && + (identical(other.rank, rank) || other.rank == rank) && + (identical(other.fxLink, fxLink) || other.fxLink == fxLink)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + name, + id, + lat, + lon, + adm2, + adm1, + country, + tz, + utcOffset, + isDst, + type, + rank, + fxLink); + + @override + String toString() { + return 'Location(name: $name, id: $id, lat: $lat, lon: $lon, adm2: $adm2, adm1: $adm1, country: $country, tz: $tz, utcOffset: $utcOffset, isDst: $isDst, type: $type, rank: $rank, fxLink: $fxLink)'; + } + + +} + +/// @nodoc +abstract mixin class $LocationCopyWith<$Res> { + factory $LocationCopyWith(Location value, + $Res Function(Location) _then) = _$LocationCopyWithImpl; + + @useResult + $Res call({ + String? name, String? id, String? lat, String? lon, String? adm2, String? adm1, String? country, String? tz, String? utcOffset, String? isDst, String? type, String? rank, String? fxLink + }); + + +} + +/// @nodoc +class _$LocationCopyWithImpl<$Res> + implements $LocationCopyWith<$Res> { + _$LocationCopyWithImpl(this._self, this._then); + + final Location _self; + final $Res Function(Location) _then; + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? name = freezed, Object? id = freezed, Object? lat = freezed, Object? lon = freezed, Object? adm2 = freezed, Object? adm1 = freezed, Object? country = freezed, Object? tz = freezed, Object? utcOffset = freezed, Object? isDst = freezed, Object? type = freezed, Object? rank = freezed, Object? fxLink = freezed,}) { + return _then(_self.copyWith( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as String?, + lat: freezed == lat + ? _self.lat + : lat // ignore: cast_nullable_to_non_nullable + as String?, + lon: freezed == lon + ? _self.lon + : lon // ignore: cast_nullable_to_non_nullable + as String?, + adm2: freezed == adm2 + ? _self.adm2 + : adm2 // ignore: cast_nullable_to_non_nullable + as String?, + adm1: freezed == adm1 + ? _self.adm1 + : adm1 // ignore: cast_nullable_to_non_nullable + as String?, + country: freezed == country + ? _self.country + : country // ignore: cast_nullable_to_non_nullable + as String?, + tz: freezed == tz ? _self.tz : tz // ignore: cast_nullable_to_non_nullable + as String?, + utcOffset: freezed == utcOffset + ? _self.utcOffset + : utcOffset // ignore: cast_nullable_to_non_nullable + as String?, + isDst: freezed == isDst + ? _self.isDst + : isDst // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + rank: freezed == rank + ? _self.rank + : rank // ignore: cast_nullable_to_non_nullable + as String?, + fxLink: freezed == fxLink + ? _self.fxLink + : fxLink // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Location implements Location { + const _Location( + {this.name, this.id, this.lat, this.lon, this.adm2, this.adm1, this.country, this.tz, this.utcOffset, this.isDst, this.type, this.rank, this.fxLink}); + + factory _Location.fromJson(Map json) => + _$LocationFromJson(json); + + @override final String? name; + @override final String? id; + @override final String? lat; + @override final String? lon; + @override final String? adm2; + @override final String? adm1; + @override final String? country; + @override final String? tz; + @override final String? utcOffset; + @override final String? isDst; + @override final String? type; + @override final String? rank; + @override final String? fxLink; + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$LocationCopyWith<_Location> get copyWith => + __$LocationCopyWithImpl<_Location>(this, _$identity); + + @override + Map toJson() { + return _$LocationToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Location && + (identical(other.name, name) || other.name == name) && + (identical(other.id, id) || other.id == id) && + (identical(other.lat, lat) || other.lat == lat) && + (identical(other.lon, lon) || other.lon == lon) && + (identical(other.adm2, adm2) || other.adm2 == adm2) && + (identical(other.adm1, adm1) || other.adm1 == adm1) && + (identical(other.country, country) || other.country == country) && + (identical(other.tz, tz) || other.tz == tz) && + (identical(other.utcOffset, utcOffset) || + other.utcOffset == utcOffset) && + (identical(other.isDst, isDst) || other.isDst == isDst) && + (identical(other.type, type) || other.type == type) && + (identical(other.rank, rank) || other.rank == rank) && + (identical(other.fxLink, fxLink) || other.fxLink == fxLink)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + name, + id, + lat, + lon, + adm2, + adm1, + country, + tz, + utcOffset, + isDst, + type, + rank, + fxLink); + + @override + String toString() { + return 'Location(name: $name, id: $id, lat: $lat, lon: $lon, adm2: $adm2, adm1: $adm1, country: $country, tz: $tz, utcOffset: $utcOffset, isDst: $isDst, type: $type, rank: $rank, fxLink: $fxLink)'; + } + + +} + +/// @nodoc +abstract mixin class _$LocationCopyWith<$Res> + implements $LocationCopyWith<$Res> { + factory _$LocationCopyWith(_Location value, + $Res Function(_Location) _then) = __$LocationCopyWithImpl; + + @override + @useResult + $Res call({ + String? name, String? id, String? lat, String? lon, String? adm2, String? adm1, String? country, String? tz, String? utcOffset, String? isDst, String? type, String? rank, String? fxLink + }); + + +} + +/// @nodoc +class __$LocationCopyWithImpl<$Res> + implements _$LocationCopyWith<$Res> { + __$LocationCopyWithImpl(this._self, this._then); + + final _Location _self; + final $Res Function(_Location) _then; + + /// Create a copy of Location + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? name = freezed, Object? id = freezed, Object? lat = freezed, Object? lon = freezed, Object? adm2 = freezed, Object? adm1 = freezed, Object? country = freezed, Object? tz = freezed, Object? utcOffset = freezed, Object? isDst = freezed, Object? type = freezed, Object? rank = freezed, Object? fxLink = freezed,}) { + return _then(_Location( + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as String?, + lat: freezed == lat + ? _self.lat + : lat // ignore: cast_nullable_to_non_nullable + as String?, + lon: freezed == lon + ? _self.lon + : lon // ignore: cast_nullable_to_non_nullable + as String?, + adm2: freezed == adm2 + ? _self.adm2 + : adm2 // ignore: cast_nullable_to_non_nullable + as String?, + adm1: freezed == adm1 + ? _self.adm1 + : adm1 // ignore: cast_nullable_to_non_nullable + as String?, + country: freezed == country + ? _self.country + : country // ignore: cast_nullable_to_non_nullable + as String?, + tz: freezed == tz ? _self.tz : tz // ignore: cast_nullable_to_non_nullable + as String?, + utcOffset: freezed == utcOffset + ? _self.utcOffset + : utcOffset // ignore: cast_nullable_to_non_nullable + as String?, + isDst: freezed == isDst + ? _self.isDst + : isDst // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + rank: freezed == rank + ? _self.rank + : rank // ignore: cast_nullable_to_non_nullable + as String?, + fxLink: freezed == fxLink + ? _self.fxLink + : fxLink // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + +} + +// dart format on diff --git a/lib/common/models/geo.g.dart b/lib/common/models/geo.g.dart new file mode 100644 index 0000000..d03fb5f --- /dev/null +++ b/lib/common/models/geo.g.dart @@ -0,0 +1,70 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'geo.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_GeoResponse _$GeoResponseFromJson(Map json) => _GeoResponse( + code: json['code'] as String?, + location: + (json['location'] as List?) + ?.map((e) => Location.fromJson(e as Map)) + .toList(), + refer: + json['refer'] == null + ? null + : Refer.fromJson(json['refer'] as Map), +); + +Map _$GeoResponseToJson(_GeoResponse instance) => + { + if (instance.code case final value?) 'code': value, + if (instance.location case final value?) 'location': value, + if (instance.refer case final value?) 'refer': value, + }; + +_Refer _$ReferFromJson(Map json) => _Refer( + sources: + (json['sources'] as List?)?.map((e) => e as String).toList(), + license: + (json['license'] as List?)?.map((e) => e as String).toList(), +); + +Map _$ReferToJson(_Refer instance) => { + if (instance.sources case final value?) 'sources': value, + if (instance.license case final value?) 'license': value, +}; + +_Location _$LocationFromJson(Map json) => _Location( + name: json['name'] as String?, + id: json['id'] as String?, + lat: json['lat'] as String?, + lon: json['lon'] as String?, + adm2: json['adm2'] as String?, + adm1: json['adm1'] as String?, + country: json['country'] as String?, + tz: json['tz'] as String?, + utcOffset: json['utcOffset'] as String?, + isDst: json['isDst'] as String?, + type: json['type'] as String?, + rank: json['rank'] as String?, + fxLink: json['fxLink'] as String?, +); + +Map _$LocationToJson(_Location instance) => { + if (instance.name case final value?) 'name': value, + if (instance.id case final value?) 'id': value, + if (instance.lat case final value?) 'lat': value, + if (instance.lon case final value?) 'lon': value, + if (instance.adm2 case final value?) 'adm2': value, + if (instance.adm1 case final value?) 'adm1': value, + if (instance.country case final value?) 'country': value, + if (instance.tz case final value?) 'tz': value, + if (instance.utcOffset case final value?) 'utcOffset': value, + if (instance.isDst case final value?) 'isDst': value, + if (instance.type case final value?) 'type': value, + if (instance.rank case final value?) 'rank': value, + if (instance.fxLink case final value?) 'fxLink': value, +}; diff --git a/lib/common/models/github.dart b/lib/common/models/github.dart index c41fd84..7cb58a3 100644 --- a/lib/common/models/github.dart +++ b/lib/common/models/github.dart @@ -1,341 +1,107 @@ -class GithubRelease { - String? url; - String? assetsUrl; - String? uploadUrl; - String? htmlUrl; - int? id; - Author? author; - String? nodeId; - String? tagName; - String? targetCommitish; - String? name; - bool? draft; - bool? prerelease; - String? createdAt; - String? publishedAt; - List? assets; - String? tarballUrl; - String? zipballUrl; - String? body; +import 'package:freezed_annotation/freezed_annotation.dart'; - GithubRelease({ - this.url, - this.assetsUrl, - this.uploadUrl, - this.htmlUrl, - this.id, - this.author, - this.nodeId, - this.tagName, - this.targetCommitish, - this.name, - this.draft, - this.prerelease, - this.createdAt, - this.publishedAt, - this.assets, - this.tarballUrl, - this.zipballUrl, - this.body, - }); +part 'github.freezed.dart'; +part 'github.g.dart'; - GithubRelease.fromJson(Map json) { - url = json["url"]; - assetsUrl = json["assets_url"]; - uploadUrl = json["upload_url"]; - htmlUrl = json["html_url"]; - id = json["id"]; - author = json["author"] == null ? null : Author.fromJson(json["author"]); - nodeId = json["node_id"]; - tagName = json["tag_name"]; - targetCommitish = json["target_commitish"]; - name = json["name"]; - draft = json["draft"]; - prerelease = json["prerelease"]; - createdAt = json["created_at"]; - publishedAt = json["published_at"]; - assets = - json["assets"] == null - ? null - : (json["assets"] as List).map((e) => Assets.fromJson(e)).toList(); - tarballUrl = json["tarball_url"]; - zipballUrl = json["zipball_url"]; - body = json["body"]; - } +@freezed +abstract class GithubRelease with _$GithubRelease { + const factory GithubRelease({ + String? url, + @JsonKey(name: 'assets_url') String? assetsUrl, + @JsonKey(name: 'upload_url') String? uploadUrl, + @JsonKey(name: 'html_url') String? htmlUrl, + int? id, + Author? author, + @JsonKey(name: 'node_id') String? nodeId, + @JsonKey(name: 'tag_name') String? tagName, + @JsonKey(name: 'target_commitish') String? targetCommitish, + String? name, + bool? draft, + bool? prerelease, + @JsonKey(name: 'created_at') String? createdAt, + @JsonKey(name: 'published_at') String? publishedAt, + List? assets, + @JsonKey(name: 'tarball_url') String? tarballUrl, + @JsonKey(name: 'zipball_url') String? zipballUrl, + String? body, + }) = _GithubRelease; - Map toJson() { - final Map data = {}; - data["url"] = url; - data["assets_url"] = assetsUrl; - data["upload_url"] = uploadUrl; - data["html_url"] = htmlUrl; - data["id"] = id; - if (author != null) { - data["author"] = author?.toJson(); - } - data["node_id"] = nodeId; - data["tag_name"] = tagName; - data["target_commitish"] = targetCommitish; - data["name"] = name; - data["draft"] = draft; - data["prerelease"] = prerelease; - data["created_at"] = createdAt; - data["published_at"] = publishedAt; - if (assets != null) { - data["assets"] = assets?.map((e) => e.toJson()).toList(); - } - data["tarball_url"] = tarballUrl; - data["zipball_url"] = zipballUrl; - data["body"] = body; - return data; - } + factory GithubRelease.fromJson(Map json) => + _$GithubReleaseFromJson(json); } -class Assets { - String? url; - int? id; - String? nodeId; - String? name; - dynamic label; - Uploader? uploader; - String? contentType; - String? state; - int? size; - int? downloadCount; - String? createdAt; - String? updatedAt; - String? browserDownloadUrl; +@freezed +abstract class Assets with _$Assets { + const factory Assets({ + String? url, + int? id, + @JsonKey(name: 'node_id') String? nodeId, + String? name, + dynamic label, + Uploader? uploader, + @JsonKey(name: 'content_type') String? contentType, + String? state, + int? size, + @JsonKey(name: 'download_count') int? downloadCount, + @JsonKey(name: 'created_at') String? createdAt, + @JsonKey(name: 'updated_at') String? updatedAt, + @JsonKey(name: 'browser_download_url') String? browserDownloadUrl, + }) = _Assets; - Assets({ - this.url, - this.id, - this.nodeId, - this.name, - this.label, - this.uploader, - this.contentType, - this.state, - this.size, - this.downloadCount, - this.createdAt, - this.updatedAt, - this.browserDownloadUrl, - }); - - Assets.fromJson(Map json) { - url = json["url"]; - id = json["id"]; - nodeId = json["node_id"]; - name = json["name"]; - label = json["label"]; - uploader = - json["uploader"] == null ? null : Uploader.fromJson(json["uploader"]); - contentType = json["content_type"]; - state = json["state"]; - size = json["size"]; - downloadCount = json["download_count"]; - createdAt = json["created_at"]; - updatedAt = json["updated_at"]; - browserDownloadUrl = json["browser_download_url"]; - } - - Map toJson() { - final Map data = {}; - data["url"] = url; - data["id"] = id; - data["node_id"] = nodeId; - data["name"] = name; - data["label"] = label; - if (uploader != null) { - data["uploader"] = uploader?.toJson(); - } - data["content_type"] = contentType; - data["state"] = state; - data["size"] = size; - data["download_count"] = downloadCount; - data["created_at"] = createdAt; - data["updated_at"] = updatedAt; - data["browser_download_url"] = browserDownloadUrl; - return data; - } + factory Assets.fromJson(Map json) => _$AssetsFromJson(json); } -class Uploader { - String? login; - int? id; - String? nodeId; - String? avatarUrl; - String? gravatarId; - String? url; - String? htmlUrl; - String? followersUrl; - String? followingUrl; - String? gistsUrl; - String? starredUrl; - String? subscriptionsUrl; - String? organizationsUrl; - String? reposUrl; - String? eventsUrl; - String? receivedEventsUrl; - String? type; - String? userViewType; - bool? siteAdmin; +@freezed +abstract class Uploader with _$Uploader { + const factory Uploader({ + String? login, + int? id, + @JsonKey(name: 'node_id') String? nodeId, + @JsonKey(name: 'avatar_url') String? avatarUrl, + @JsonKey(name: 'gravatar_id') String? gravatarId, + String? url, + @JsonKey(name: 'html_url') String? htmlUrl, + @JsonKey(name: 'followers_url') String? followersUrl, + @JsonKey(name: 'following_url') String? followingUrl, + @JsonKey(name: 'gists_url') String? gistsUrl, + @JsonKey(name: 'starred_url') String? starredUrl, + @JsonKey(name: 'subscriptions_url') String? subscriptionsUrl, + @JsonKey(name: 'organizations_url') String? organizationsUrl, + @JsonKey(name: 'repos_url') String? reposUrl, + @JsonKey(name: 'events_url') String? eventsUrl, + @JsonKey(name: 'received_events_url') String? receivedEventsUrl, + String? type, + @JsonKey(name: 'user_view_type') String? userViewType, + @JsonKey(name: 'site_admin') bool? siteAdmin, + }) = _Uploader; - Uploader({ - this.login, - this.id, - this.nodeId, - this.avatarUrl, - this.gravatarId, - this.url, - this.htmlUrl, - this.followersUrl, - this.followingUrl, - this.gistsUrl, - this.starredUrl, - this.subscriptionsUrl, - this.organizationsUrl, - this.reposUrl, - this.eventsUrl, - this.receivedEventsUrl, - this.type, - this.userViewType, - this.siteAdmin, - }); - - Uploader.fromJson(Map json) { - login = json["login"]; - id = json["id"]; - nodeId = json["node_id"]; - avatarUrl = json["avatar_url"]; - gravatarId = json["gravatar_id"]; - url = json["url"]; - htmlUrl = json["html_url"]; - followersUrl = json["followers_url"]; - followingUrl = json["following_url"]; - gistsUrl = json["gists_url"]; - starredUrl = json["starred_url"]; - subscriptionsUrl = json["subscriptions_url"]; - organizationsUrl = json["organizations_url"]; - reposUrl = json["repos_url"]; - eventsUrl = json["events_url"]; - receivedEventsUrl = json["received_events_url"]; - type = json["type"]; - userViewType = json["user_view_type"]; - siteAdmin = json["site_admin"]; - } - - Map toJson() { - final Map data = {}; - data["login"] = login; - data["id"] = id; - data["node_id"] = nodeId; - data["avatar_url"] = avatarUrl; - data["gravatar_id"] = gravatarId; - data["url"] = url; - data["html_url"] = htmlUrl; - data["followers_url"] = followersUrl; - data["following_url"] = followingUrl; - data["gists_url"] = gistsUrl; - data["starred_url"] = starredUrl; - data["subscriptions_url"] = subscriptionsUrl; - data["organizations_url"] = organizationsUrl; - data["repos_url"] = reposUrl; - data["events_url"] = eventsUrl; - data["received_events_url"] = receivedEventsUrl; - data["type"] = type; - data["user_view_type"] = userViewType; - data["site_admin"] = siteAdmin; - return data; - } + factory Uploader.fromJson(Map json) => + _$UploaderFromJson(json); } -class Author { - String? login; - int? id; - String? nodeId; - String? avatarUrl; - String? gravatarId; - String? url; - String? htmlUrl; - String? followersUrl; - String? followingUrl; - String? gistsUrl; - String? starredUrl; - String? subscriptionsUrl; - String? organizationsUrl; - String? reposUrl; - String? eventsUrl; - String? receivedEventsUrl; - String? type; - String? userViewType; - bool? siteAdmin; +@freezed +abstract class Author with _$Author { + const factory Author({ + String? login, + int? id, + @JsonKey(name: 'node_id') String? nodeId, + @JsonKey(name: 'avatar_url') String? avatarUrl, + @JsonKey(name: 'gravatar_id') String? gravatarId, + String? url, + @JsonKey(name: 'html_url') String? htmlUrl, + @JsonKey(name: 'followers_url') String? followersUrl, + @JsonKey(name: 'following_url') String? followingUrl, + @JsonKey(name: 'gists_url') String? gistsUrl, + @JsonKey(name: 'starred_url') String? starredUrl, + @JsonKey(name: 'subscriptions_url') String? subscriptionsUrl, + @JsonKey(name: 'organizations_url') String? organizationsUrl, + @JsonKey(name: 'repos_url') String? reposUrl, + @JsonKey(name: 'events_url') String? eventsUrl, + @JsonKey(name: 'received_events_url') String? receivedEventsUrl, + String? type, + @JsonKey(name: 'user_view_type') String? userViewType, + @JsonKey(name: 'site_admin') bool? siteAdmin, + }) = _Author; - Author({ - this.login, - this.id, - this.nodeId, - this.avatarUrl, - this.gravatarId, - this.url, - this.htmlUrl, - this.followersUrl, - this.followingUrl, - this.gistsUrl, - this.starredUrl, - this.subscriptionsUrl, - this.organizationsUrl, - this.reposUrl, - this.eventsUrl, - this.receivedEventsUrl, - this.type, - this.userViewType, - this.siteAdmin, - }); - - Author.fromJson(Map json) { - login = json["login"]; - id = json["id"]; - nodeId = json["node_id"]; - avatarUrl = json["avatar_url"]; - gravatarId = json["gravatar_id"]; - url = json["url"]; - htmlUrl = json["html_url"]; - followersUrl = json["followers_url"]; - followingUrl = json["following_url"]; - gistsUrl = json["gists_url"]; - starredUrl = json["starred_url"]; - subscriptionsUrl = json["subscriptions_url"]; - organizationsUrl = json["organizations_url"]; - reposUrl = json["repos_url"]; - eventsUrl = json["events_url"]; - receivedEventsUrl = json["received_events_url"]; - type = json["type"]; - userViewType = json["user_view_type"]; - siteAdmin = json["site_admin"]; - } - - Map toJson() { - final Map data = {}; - data["login"] = login; - data["id"] = id; - data["node_id"] = nodeId; - data["avatar_url"] = avatarUrl; - data["gravatar_id"] = gravatarId; - data["url"] = url; - data["html_url"] = htmlUrl; - data["followers_url"] = followersUrl; - data["following_url"] = followingUrl; - data["gists_url"] = gistsUrl; - data["starred_url"] = starredUrl; - data["subscriptions_url"] = subscriptionsUrl; - data["organizations_url"] = organizationsUrl; - data["repos_url"] = reposUrl; - data["events_url"] = eventsUrl; - data["received_events_url"] = receivedEventsUrl; - data["type"] = type; - data["user_view_type"] = userViewType; - data["site_admin"] = siteAdmin; - return data; - } + factory Author.fromJson(Map json) => _$AuthorFromJson(json); } diff --git a/lib/common/models/github.freezed.dart b/lib/common/models/github.freezed.dart new file mode 100644 index 0000000..e48e692 --- /dev/null +++ b/lib/common/models/github.freezed.dart @@ -0,0 +1,1997 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'github.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$GithubRelease { + + String? get url; + + @JsonKey(name: 'assets_url') String? get assetsUrl; + + @JsonKey(name: 'upload_url') String? get uploadUrl; + + @JsonKey(name: 'html_url') String? get htmlUrl; + + int? get id; + + Author? get author; + + @JsonKey(name: 'node_id') String? get nodeId; + + @JsonKey(name: 'tag_name') String? get tagName; + + @JsonKey(name: 'target_commitish') String? get targetCommitish; + + String? get name; + + bool? get draft; + + bool? get prerelease; + + @JsonKey(name: 'created_at') String? get createdAt; + + @JsonKey(name: 'published_at') String? get publishedAt; + + List? get assets; + + @JsonKey(name: 'tarball_url') String? get tarballUrl; + + @JsonKey(name: 'zipball_url') String? get zipballUrl; + + String? get body; + + /// Create a copy of GithubRelease + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $GithubReleaseCopyWith get copyWith => + _$GithubReleaseCopyWithImpl( + this as GithubRelease, _$identity); + + /// Serializes this GithubRelease to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is GithubRelease && + (identical(other.url, url) || other.url == url) && + (identical(other.assetsUrl, assetsUrl) || + other.assetsUrl == assetsUrl) && + (identical(other.uploadUrl, uploadUrl) || + other.uploadUrl == uploadUrl) && + (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && + (identical(other.id, id) || other.id == id) && + (identical(other.author, author) || other.author == author) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.tagName, tagName) || other.tagName == tagName) && + (identical(other.targetCommitish, targetCommitish) || + other.targetCommitish == targetCommitish) && + (identical(other.name, name) || other.name == name) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.prerelease, prerelease) || + other.prerelease == prerelease) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.publishedAt, publishedAt) || + other.publishedAt == publishedAt) && + const DeepCollectionEquality().equals(other.assets, assets) && + (identical(other.tarballUrl, tarballUrl) || + other.tarballUrl == tarballUrl) && + (identical(other.zipballUrl, zipballUrl) || + other.zipballUrl == zipballUrl) && + (identical(other.body, body) || other.body == body)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + url, + assetsUrl, + uploadUrl, + htmlUrl, + id, + author, + nodeId, + tagName, + targetCommitish, + name, + draft, + prerelease, + createdAt, + publishedAt, + const DeepCollectionEquality().hash(assets), + tarballUrl, + zipballUrl, + body); + + @override + String toString() { + return 'GithubRelease(url: $url, assetsUrl: $assetsUrl, uploadUrl: $uploadUrl, htmlUrl: $htmlUrl, id: $id, author: $author, nodeId: $nodeId, tagName: $tagName, targetCommitish: $targetCommitish, name: $name, draft: $draft, prerelease: $prerelease, createdAt: $createdAt, publishedAt: $publishedAt, assets: $assets, tarballUrl: $tarballUrl, zipballUrl: $zipballUrl, body: $body)'; + } + + +} + +/// @nodoc +abstract mixin class $GithubReleaseCopyWith<$Res> { + factory $GithubReleaseCopyWith(GithubRelease value, + $Res Function(GithubRelease) _then) = _$GithubReleaseCopyWithImpl; + + @useResult + $Res call({ + String? url, @JsonKey(name: 'assets_url') String? assetsUrl, @JsonKey( + name: 'upload_url') String? uploadUrl, @JsonKey( + name: 'html_url') String? htmlUrl, int? id, Author? author, @JsonKey( + name: 'node_id') String? nodeId, @JsonKey( + name: 'tag_name') String? tagName, @JsonKey( + name: 'target_commitish') String? targetCommitish, String? name, bool? draft, bool? prerelease, @JsonKey( + name: 'created_at') String? createdAt, @JsonKey( + name: 'published_at') String? publishedAt, List< + Assets>? assets, @JsonKey( + name: 'tarball_url') String? tarballUrl, @JsonKey( + name: 'zipball_url') String? zipballUrl, String? body + }); + + + $AuthorCopyWith<$Res>? get author; + +} + +/// @nodoc +class _$GithubReleaseCopyWithImpl<$Res> + implements $GithubReleaseCopyWith<$Res> { + _$GithubReleaseCopyWithImpl(this._self, this._then); + + final GithubRelease _self; + final $Res Function(GithubRelease) _then; + + /// Create a copy of GithubRelease + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? url = freezed, Object? assetsUrl = freezed, Object? uploadUrl = freezed, Object? htmlUrl = freezed, Object? id = freezed, Object? author = freezed, Object? nodeId = freezed, Object? tagName = freezed, Object? targetCommitish = freezed, Object? name = freezed, Object? draft = freezed, Object? prerelease = freezed, Object? createdAt = freezed, Object? publishedAt = freezed, Object? assets = freezed, Object? tarballUrl = freezed, Object? zipballUrl = freezed, Object? body = freezed,}) { + return _then(_self.copyWith( + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + assetsUrl: freezed == assetsUrl + ? _self.assetsUrl + : assetsUrl // ignore: cast_nullable_to_non_nullable + as String?, + uploadUrl: freezed == uploadUrl + ? _self.uploadUrl + : uploadUrl // ignore: cast_nullable_to_non_nullable + as String?, + htmlUrl: freezed == htmlUrl + ? _self.htmlUrl + : htmlUrl // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + author: freezed == author + ? _self.author + : author // ignore: cast_nullable_to_non_nullable + as Author?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + tagName: freezed == tagName + ? _self.tagName + : tagName // ignore: cast_nullable_to_non_nullable + as String?, + targetCommitish: freezed == targetCommitish + ? _self.targetCommitish + : targetCommitish // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as bool?, + prerelease: freezed == prerelease + ? _self.prerelease + : prerelease // ignore: cast_nullable_to_non_nullable + as bool?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + publishedAt: freezed == publishedAt + ? _self.publishedAt + : publishedAt // ignore: cast_nullable_to_non_nullable + as String?, + assets: freezed == assets + ? _self.assets + : assets // ignore: cast_nullable_to_non_nullable + as List?, + tarballUrl: freezed == tarballUrl + ? _self.tarballUrl + : tarballUrl // ignore: cast_nullable_to_non_nullable + as String?, + zipballUrl: freezed == zipballUrl + ? _self.zipballUrl + : zipballUrl // ignore: cast_nullable_to_non_nullable + as String?, + body: freezed == body + ? _self.body + : body // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + /// Create a copy of GithubRelease + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $AuthorCopyWith<$Res>? get author { + if (_self.author == null) { + return null; + } + + return $AuthorCopyWith<$Res>(_self.author!, (value) { + return _then(_self.copyWith(author: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _GithubRelease implements GithubRelease { + const _GithubRelease( + {this.url, @JsonKey(name: 'assets_url') this.assetsUrl, @JsonKey( + name: 'upload_url') this.uploadUrl, @JsonKey( + name: 'html_url') this.htmlUrl, this.id, this.author, @JsonKey( + name: 'node_id') this.nodeId, @JsonKey( + name: 'tag_name') this.tagName, @JsonKey( + name: 'target_commitish') this.targetCommitish, this.name, this.draft, this.prerelease, @JsonKey( + name: 'created_at') this.createdAt, @JsonKey( + name: 'published_at') this.publishedAt, final List< + Assets>? assets, @JsonKey( + name: 'tarball_url') this.tarballUrl, @JsonKey( + name: 'zipball_url') this.zipballUrl, this.body}) : _assets = assets; + + factory _GithubRelease.fromJson(Map json) => + _$GithubReleaseFromJson(json); + + @override final String? url; + @override + @JsonKey(name: 'assets_url') + final String? assetsUrl; + @override + @JsonKey(name: 'upload_url') + final String? uploadUrl; + @override + @JsonKey(name: 'html_url') + final String? htmlUrl; + @override final int? id; + @override final Author? author; + @override + @JsonKey(name: 'node_id') + final String? nodeId; + @override + @JsonKey(name: 'tag_name') + final String? tagName; + @override + @JsonKey(name: 'target_commitish') + final String? targetCommitish; + @override final String? name; + @override final bool? draft; + @override final bool? prerelease; + @override + @JsonKey(name: 'created_at') + final String? createdAt; + @override + @JsonKey(name: 'published_at') + final String? publishedAt; + final List? _assets; + + @override List? get assets { + final value = _assets; + if (value == null) return null; + if (_assets is EqualUnmodifiableListView) return _assets; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + @JsonKey(name: 'tarball_url') + final String? tarballUrl; + @override + @JsonKey(name: 'zipball_url') + final String? zipballUrl; + @override final String? body; + + /// Create a copy of GithubRelease + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$GithubReleaseCopyWith<_GithubRelease> get copyWith => + __$GithubReleaseCopyWithImpl<_GithubRelease>(this, _$identity); + + @override + Map toJson() { + return _$GithubReleaseToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _GithubRelease && + (identical(other.url, url) || other.url == url) && + (identical(other.assetsUrl, assetsUrl) || + other.assetsUrl == assetsUrl) && + (identical(other.uploadUrl, uploadUrl) || + other.uploadUrl == uploadUrl) && + (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && + (identical(other.id, id) || other.id == id) && + (identical(other.author, author) || other.author == author) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.tagName, tagName) || other.tagName == tagName) && + (identical(other.targetCommitish, targetCommitish) || + other.targetCommitish == targetCommitish) && + (identical(other.name, name) || other.name == name) && + (identical(other.draft, draft) || other.draft == draft) && + (identical(other.prerelease, prerelease) || + other.prerelease == prerelease) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.publishedAt, publishedAt) || + other.publishedAt == publishedAt) && + const DeepCollectionEquality().equals(other._assets, _assets) && + (identical(other.tarballUrl, tarballUrl) || + other.tarballUrl == tarballUrl) && + (identical(other.zipballUrl, zipballUrl) || + other.zipballUrl == zipballUrl) && + (identical(other.body, body) || other.body == body)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + url, + assetsUrl, + uploadUrl, + htmlUrl, + id, + author, + nodeId, + tagName, + targetCommitish, + name, + draft, + prerelease, + createdAt, + publishedAt, + const DeepCollectionEquality().hash(_assets), + tarballUrl, + zipballUrl, + body); + + @override + String toString() { + return 'GithubRelease(url: $url, assetsUrl: $assetsUrl, uploadUrl: $uploadUrl, htmlUrl: $htmlUrl, id: $id, author: $author, nodeId: $nodeId, tagName: $tagName, targetCommitish: $targetCommitish, name: $name, draft: $draft, prerelease: $prerelease, createdAt: $createdAt, publishedAt: $publishedAt, assets: $assets, tarballUrl: $tarballUrl, zipballUrl: $zipballUrl, body: $body)'; + } + + +} + +/// @nodoc +abstract mixin class _$GithubReleaseCopyWith<$Res> + implements $GithubReleaseCopyWith<$Res> { + factory _$GithubReleaseCopyWith(_GithubRelease value, + $Res Function(_GithubRelease) _then) = __$GithubReleaseCopyWithImpl; + + @override + @useResult + $Res call({ + String? url, @JsonKey(name: 'assets_url') String? assetsUrl, @JsonKey( + name: 'upload_url') String? uploadUrl, @JsonKey( + name: 'html_url') String? htmlUrl, int? id, Author? author, @JsonKey( + name: 'node_id') String? nodeId, @JsonKey( + name: 'tag_name') String? tagName, @JsonKey( + name: 'target_commitish') String? targetCommitish, String? name, bool? draft, bool? prerelease, @JsonKey( + name: 'created_at') String? createdAt, @JsonKey( + name: 'published_at') String? publishedAt, List< + Assets>? assets, @JsonKey( + name: 'tarball_url') String? tarballUrl, @JsonKey( + name: 'zipball_url') String? zipballUrl, String? body + }); + + + @override $AuthorCopyWith<$Res>? get author; + +} + +/// @nodoc +class __$GithubReleaseCopyWithImpl<$Res> + implements _$GithubReleaseCopyWith<$Res> { + __$GithubReleaseCopyWithImpl(this._self, this._then); + + final _GithubRelease _self; + final $Res Function(_GithubRelease) _then; + + /// Create a copy of GithubRelease + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? url = freezed, Object? assetsUrl = freezed, Object? uploadUrl = freezed, Object? htmlUrl = freezed, Object? id = freezed, Object? author = freezed, Object? nodeId = freezed, Object? tagName = freezed, Object? targetCommitish = freezed, Object? name = freezed, Object? draft = freezed, Object? prerelease = freezed, Object? createdAt = freezed, Object? publishedAt = freezed, Object? assets = freezed, Object? tarballUrl = freezed, Object? zipballUrl = freezed, Object? body = freezed,}) { + return _then(_GithubRelease( + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + assetsUrl: freezed == assetsUrl + ? _self.assetsUrl + : assetsUrl // ignore: cast_nullable_to_non_nullable + as String?, + uploadUrl: freezed == uploadUrl + ? _self.uploadUrl + : uploadUrl // ignore: cast_nullable_to_non_nullable + as String?, + htmlUrl: freezed == htmlUrl + ? _self.htmlUrl + : htmlUrl // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + author: freezed == author + ? _self.author + : author // ignore: cast_nullable_to_non_nullable + as Author?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + tagName: freezed == tagName + ? _self.tagName + : tagName // ignore: cast_nullable_to_non_nullable + as String?, + targetCommitish: freezed == targetCommitish + ? _self.targetCommitish + : targetCommitish // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + draft: freezed == draft + ? _self.draft + : draft // ignore: cast_nullable_to_non_nullable + as bool?, + prerelease: freezed == prerelease + ? _self.prerelease + : prerelease // ignore: cast_nullable_to_non_nullable + as bool?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + publishedAt: freezed == publishedAt + ? _self.publishedAt + : publishedAt // ignore: cast_nullable_to_non_nullable + as String?, + assets: freezed == assets + ? _self._assets + : assets // ignore: cast_nullable_to_non_nullable + as List?, + tarballUrl: freezed == tarballUrl + ? _self.tarballUrl + : tarballUrl // ignore: cast_nullable_to_non_nullable + as String?, + zipballUrl: freezed == zipballUrl + ? _self.zipballUrl + : zipballUrl // ignore: cast_nullable_to_non_nullable + as String?, + body: freezed == body + ? _self.body + : body // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + /// Create a copy of GithubRelease + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $AuthorCopyWith<$Res>? get author { + if (_self.author == null) { + return null; + } + + return $AuthorCopyWith<$Res>(_self.author!, (value) { + return _then(_self.copyWith(author: value)); + }); + } +} + + +/// @nodoc +mixin _$Assets { + + String? get url; + + int? get id; + + @JsonKey(name: 'node_id') String? get nodeId; + + String? get name; + + dynamic get label; + + Uploader? get uploader; + + @JsonKey(name: 'content_type') String? get contentType; + + String? get state; + + int? get size; + + @JsonKey(name: 'download_count') int? get downloadCount; + + @JsonKey(name: 'created_at') String? get createdAt; + + @JsonKey(name: 'updated_at') String? get updatedAt; + + @JsonKey(name: 'browser_download_url') String? get browserDownloadUrl; + + /// Create a copy of Assets + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AssetsCopyWith get copyWith => + _$AssetsCopyWithImpl(this as Assets, _$identity); + + /// Serializes this Assets to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Assets && + (identical(other.url, url) || other.url == url) && + (identical(other.id, id) || other.id == id) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.label, label) && + (identical(other.uploader, uploader) || + other.uploader == uploader) && + (identical(other.contentType, contentType) || + other.contentType == contentType) && + (identical(other.state, state) || other.state == state) && + (identical(other.size, size) || other.size == size) && + (identical(other.downloadCount, downloadCount) || + other.downloadCount == downloadCount) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt) && + (identical(other.browserDownloadUrl, browserDownloadUrl) || + other.browserDownloadUrl == browserDownloadUrl)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + url, + id, + nodeId, + name, + const DeepCollectionEquality().hash(label), + uploader, + contentType, + state, + size, + downloadCount, + createdAt, + updatedAt, + browserDownloadUrl); + + @override + String toString() { + return 'Assets(url: $url, id: $id, nodeId: $nodeId, name: $name, label: $label, uploader: $uploader, contentType: $contentType, state: $state, size: $size, downloadCount: $downloadCount, createdAt: $createdAt, updatedAt: $updatedAt, browserDownloadUrl: $browserDownloadUrl)'; + } + + +} + +/// @nodoc +abstract mixin class $AssetsCopyWith<$Res> { + factory $AssetsCopyWith(Assets value, + $Res Function(Assets) _then) = _$AssetsCopyWithImpl; + + @useResult + $Res call({ + String? url, int? id, @JsonKey( + name: 'node_id') String? nodeId, String? name, dynamic label, Uploader? uploader, @JsonKey( + name: 'content_type') String? contentType, String? state, int? size, @JsonKey( + name: 'download_count') int? downloadCount, @JsonKey( + name: 'created_at') String? createdAt, @JsonKey( + name: 'updated_at') String? updatedAt, @JsonKey( + name: 'browser_download_url') String? browserDownloadUrl + }); + + + $UploaderCopyWith<$Res>? get uploader; + +} + +/// @nodoc +class _$AssetsCopyWithImpl<$Res> + implements $AssetsCopyWith<$Res> { + _$AssetsCopyWithImpl(this._self, this._then); + + final Assets _self; + final $Res Function(Assets) _then; + + /// Create a copy of Assets + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? url = freezed, Object? id = freezed, Object? nodeId = freezed, Object? name = freezed, Object? label = freezed, Object? uploader = freezed, Object? contentType = freezed, Object? state = freezed, Object? size = freezed, Object? downloadCount = freezed, Object? createdAt = freezed, Object? updatedAt = freezed, Object? browserDownloadUrl = freezed,}) { + return _then(_self.copyWith( + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + label: freezed == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as dynamic, + uploader: freezed == uploader + ? _self.uploader + : uploader // ignore: cast_nullable_to_non_nullable + as Uploader?, + contentType: freezed == contentType + ? _self.contentType + : contentType // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _self.state + : state // ignore: cast_nullable_to_non_nullable + as String?, + size: freezed == size + ? _self.size + : size // ignore: cast_nullable_to_non_nullable + as int?, + downloadCount: freezed == downloadCount + ? _self.downloadCount + : downloadCount // ignore: cast_nullable_to_non_nullable + as int?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + updatedAt: freezed == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as String?, + browserDownloadUrl: freezed == browserDownloadUrl + ? _self.browserDownloadUrl + : browserDownloadUrl // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + /// Create a copy of Assets + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UploaderCopyWith<$Res>? get uploader { + if (_self.uploader == null) { + return null; + } + + return $UploaderCopyWith<$Res>(_self.uploader!, (value) { + return _then(_self.copyWith(uploader: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _Assets implements Assets { + const _Assets({this.url, this.id, @JsonKey( + name: 'node_id') this.nodeId, this.name, this.label, this.uploader, @JsonKey( + name: 'content_type') this.contentType, this.state, this.size, @JsonKey( + name: 'download_count') this.downloadCount, @JsonKey( + name: 'created_at') this.createdAt, @JsonKey( + name: 'updated_at') this.updatedAt, @JsonKey( + name: 'browser_download_url') this.browserDownloadUrl}); + + factory _Assets.fromJson(Map json) => _$AssetsFromJson(json); + + @override final String? url; + @override final int? id; + @override + @JsonKey(name: 'node_id') + final String? nodeId; + @override final String? name; + @override final dynamic label; + @override final Uploader? uploader; + @override + @JsonKey(name: 'content_type') + final String? contentType; + @override final String? state; + @override final int? size; + @override + @JsonKey(name: 'download_count') + final int? downloadCount; + @override + @JsonKey(name: 'created_at') + final String? createdAt; + @override + @JsonKey(name: 'updated_at') + final String? updatedAt; + @override + @JsonKey(name: 'browser_download_url') + final String? browserDownloadUrl; + + /// Create a copy of Assets + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$AssetsCopyWith<_Assets> get copyWith => + __$AssetsCopyWithImpl<_Assets>(this, _$identity); + + @override + Map toJson() { + return _$AssetsToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Assets && + (identical(other.url, url) || other.url == url) && + (identical(other.id, id) || other.id == id) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other.label, label) && + (identical(other.uploader, uploader) || + other.uploader == uploader) && + (identical(other.contentType, contentType) || + other.contentType == contentType) && + (identical(other.state, state) || other.state == state) && + (identical(other.size, size) || other.size == size) && + (identical(other.downloadCount, downloadCount) || + other.downloadCount == downloadCount) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt) && + (identical(other.browserDownloadUrl, browserDownloadUrl) || + other.browserDownloadUrl == browserDownloadUrl)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + url, + id, + nodeId, + name, + const DeepCollectionEquality().hash(label), + uploader, + contentType, + state, + size, + downloadCount, + createdAt, + updatedAt, + browserDownloadUrl); + + @override + String toString() { + return 'Assets(url: $url, id: $id, nodeId: $nodeId, name: $name, label: $label, uploader: $uploader, contentType: $contentType, state: $state, size: $size, downloadCount: $downloadCount, createdAt: $createdAt, updatedAt: $updatedAt, browserDownloadUrl: $browserDownloadUrl)'; + } + + +} + +/// @nodoc +abstract mixin class _$AssetsCopyWith<$Res> implements $AssetsCopyWith<$Res> { + factory _$AssetsCopyWith(_Assets value, + $Res Function(_Assets) _then) = __$AssetsCopyWithImpl; + + @override + @useResult + $Res call({ + String? url, int? id, @JsonKey( + name: 'node_id') String? nodeId, String? name, dynamic label, Uploader? uploader, @JsonKey( + name: 'content_type') String? contentType, String? state, int? size, @JsonKey( + name: 'download_count') int? downloadCount, @JsonKey( + name: 'created_at') String? createdAt, @JsonKey( + name: 'updated_at') String? updatedAt, @JsonKey( + name: 'browser_download_url') String? browserDownloadUrl + }); + + + @override $UploaderCopyWith<$Res>? get uploader; + +} + +/// @nodoc +class __$AssetsCopyWithImpl<$Res> + implements _$AssetsCopyWith<$Res> { + __$AssetsCopyWithImpl(this._self, this._then); + + final _Assets _self; + final $Res Function(_Assets) _then; + + /// Create a copy of Assets + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? url = freezed, Object? id = freezed, Object? nodeId = freezed, Object? name = freezed, Object? label = freezed, Object? uploader = freezed, Object? contentType = freezed, Object? state = freezed, Object? size = freezed, Object? downloadCount = freezed, Object? createdAt = freezed, Object? updatedAt = freezed, Object? browserDownloadUrl = freezed,}) { + return _then(_Assets( + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + label: freezed == label + ? _self.label + : label // ignore: cast_nullable_to_non_nullable + as dynamic, + uploader: freezed == uploader + ? _self.uploader + : uploader // ignore: cast_nullable_to_non_nullable + as Uploader?, + contentType: freezed == contentType + ? _self.contentType + : contentType // ignore: cast_nullable_to_non_nullable + as String?, + state: freezed == state + ? _self.state + : state // ignore: cast_nullable_to_non_nullable + as String?, + size: freezed == size + ? _self.size + : size // ignore: cast_nullable_to_non_nullable + as int?, + downloadCount: freezed == downloadCount + ? _self.downloadCount + : downloadCount // ignore: cast_nullable_to_non_nullable + as int?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + updatedAt: freezed == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as String?, + browserDownloadUrl: freezed == browserDownloadUrl + ? _self.browserDownloadUrl + : browserDownloadUrl // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + /// Create a copy of Assets + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UploaderCopyWith<$Res>? get uploader { + if (_self.uploader == null) { + return null; + } + + return $UploaderCopyWith<$Res>(_self.uploader!, (value) { + return _then(_self.copyWith(uploader: value)); + }); + } +} + + +/// @nodoc +mixin _$Uploader { + + String? get login; + + int? get id; + + @JsonKey(name: 'node_id') String? get nodeId; + + @JsonKey(name: 'avatar_url') String? get avatarUrl; + + @JsonKey(name: 'gravatar_id') String? get gravatarId; + + String? get url; + + @JsonKey(name: 'html_url') String? get htmlUrl; + + @JsonKey(name: 'followers_url') String? get followersUrl; + + @JsonKey(name: 'following_url') String? get followingUrl; + + @JsonKey(name: 'gists_url') String? get gistsUrl; + + @JsonKey(name: 'starred_url') String? get starredUrl; + + @JsonKey(name: 'subscriptions_url') String? get subscriptionsUrl; + + @JsonKey(name: 'organizations_url') String? get organizationsUrl; + + @JsonKey(name: 'repos_url') String? get reposUrl; + + @JsonKey(name: 'events_url') String? get eventsUrl; + + @JsonKey(name: 'received_events_url') String? get receivedEventsUrl; + + String? get type; + + @JsonKey(name: 'user_view_type') String? get userViewType; + + @JsonKey(name: 'site_admin') bool? get siteAdmin; + + /// Create a copy of Uploader + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UploaderCopyWith get copyWith => + _$UploaderCopyWithImpl(this as Uploader, _$identity); + + /// Serializes this Uploader to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Uploader && + (identical(other.login, login) || other.login == login) && + (identical(other.id, id) || other.id == id) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.avatarUrl, avatarUrl) || + other.avatarUrl == avatarUrl) && + (identical(other.gravatarId, gravatarId) || + other.gravatarId == gravatarId) && + (identical(other.url, url) || other.url == url) && + (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && + (identical(other.followersUrl, followersUrl) || + other.followersUrl == followersUrl) && + (identical(other.followingUrl, followingUrl) || + other.followingUrl == followingUrl) && + (identical(other.gistsUrl, gistsUrl) || + other.gistsUrl == gistsUrl) && + (identical(other.starredUrl, starredUrl) || + other.starredUrl == starredUrl) && + (identical(other.subscriptionsUrl, subscriptionsUrl) || + other.subscriptionsUrl == subscriptionsUrl) && + (identical(other.organizationsUrl, organizationsUrl) || + other.organizationsUrl == organizationsUrl) && + (identical(other.reposUrl, reposUrl) || + other.reposUrl == reposUrl) && + (identical(other.eventsUrl, eventsUrl) || + other.eventsUrl == eventsUrl) && + (identical(other.receivedEventsUrl, receivedEventsUrl) || + other.receivedEventsUrl == receivedEventsUrl) && + (identical(other.type, type) || other.type == type) && + (identical(other.userViewType, userViewType) || + other.userViewType == userViewType) && + (identical(other.siteAdmin, siteAdmin) || + other.siteAdmin == siteAdmin)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hashAll([ + runtimeType, + login, + id, + nodeId, + avatarUrl, + gravatarId, + url, + htmlUrl, + followersUrl, + followingUrl, + gistsUrl, + starredUrl, + subscriptionsUrl, + organizationsUrl, + reposUrl, + eventsUrl, + receivedEventsUrl, + type, + userViewType, + siteAdmin + ]); + + @override + String toString() { + return 'Uploader(login: $login, id: $id, nodeId: $nodeId, avatarUrl: $avatarUrl, gravatarId: $gravatarId, url: $url, htmlUrl: $htmlUrl, followersUrl: $followersUrl, followingUrl: $followingUrl, gistsUrl: $gistsUrl, starredUrl: $starredUrl, subscriptionsUrl: $subscriptionsUrl, organizationsUrl: $organizationsUrl, reposUrl: $reposUrl, eventsUrl: $eventsUrl, receivedEventsUrl: $receivedEventsUrl, type: $type, userViewType: $userViewType, siteAdmin: $siteAdmin)'; + } + + +} + +/// @nodoc +abstract mixin class $UploaderCopyWith<$Res> { + factory $UploaderCopyWith(Uploader value, + $Res Function(Uploader) _then) = _$UploaderCopyWithImpl; + + @useResult + $Res call({ + String? login, int? id, @JsonKey(name: 'node_id') String? nodeId, @JsonKey( + name: 'avatar_url') String? avatarUrl, @JsonKey( + name: 'gravatar_id') String? gravatarId, String? url, @JsonKey( + name: 'html_url') String? htmlUrl, @JsonKey( + name: 'followers_url') String? followersUrl, @JsonKey( + name: 'following_url') String? followingUrl, @JsonKey( + name: 'gists_url') String? gistsUrl, @JsonKey( + name: 'starred_url') String? starredUrl, @JsonKey( + name: 'subscriptions_url') String? subscriptionsUrl, @JsonKey( + name: 'organizations_url') String? organizationsUrl, @JsonKey( + name: 'repos_url') String? reposUrl, @JsonKey( + name: 'events_url') String? eventsUrl, @JsonKey( + name: 'received_events_url') String? receivedEventsUrl, String? type, @JsonKey( + name: 'user_view_type') String? userViewType, @JsonKey( + name: 'site_admin') bool? siteAdmin + }); + + +} + +/// @nodoc +class _$UploaderCopyWithImpl<$Res> + implements $UploaderCopyWith<$Res> { + _$UploaderCopyWithImpl(this._self, this._then); + + final Uploader _self; + final $Res Function(Uploader) _then; + + /// Create a copy of Uploader + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? login = freezed, Object? id = freezed, Object? nodeId = freezed, Object? avatarUrl = freezed, Object? gravatarId = freezed, Object? url = freezed, Object? htmlUrl = freezed, Object? followersUrl = freezed, Object? followingUrl = freezed, Object? gistsUrl = freezed, Object? starredUrl = freezed, Object? subscriptionsUrl = freezed, Object? organizationsUrl = freezed, Object? reposUrl = freezed, Object? eventsUrl = freezed, Object? receivedEventsUrl = freezed, Object? type = freezed, Object? userViewType = freezed, Object? siteAdmin = freezed,}) { + return _then(_self.copyWith( + login: freezed == login + ? _self.login + : login // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + avatarUrl: freezed == avatarUrl + ? _self.avatarUrl + : avatarUrl // ignore: cast_nullable_to_non_nullable + as String?, + gravatarId: freezed == gravatarId + ? _self.gravatarId + : gravatarId // ignore: cast_nullable_to_non_nullable + as String?, + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + htmlUrl: freezed == htmlUrl + ? _self.htmlUrl + : htmlUrl // ignore: cast_nullable_to_non_nullable + as String?, + followersUrl: freezed == followersUrl + ? _self.followersUrl + : followersUrl // ignore: cast_nullable_to_non_nullable + as String?, + followingUrl: freezed == followingUrl + ? _self.followingUrl + : followingUrl // ignore: cast_nullable_to_non_nullable + as String?, + gistsUrl: freezed == gistsUrl + ? _self.gistsUrl + : gistsUrl // ignore: cast_nullable_to_non_nullable + as String?, + starredUrl: freezed == starredUrl + ? _self.starredUrl + : starredUrl // ignore: cast_nullable_to_non_nullable + as String?, + subscriptionsUrl: freezed == subscriptionsUrl + ? _self.subscriptionsUrl + : subscriptionsUrl // ignore: cast_nullable_to_non_nullable + as String?, + organizationsUrl: freezed == organizationsUrl + ? _self.organizationsUrl + : organizationsUrl // ignore: cast_nullable_to_non_nullable + as String?, + reposUrl: freezed == reposUrl + ? _self.reposUrl + : reposUrl // ignore: cast_nullable_to_non_nullable + as String?, + eventsUrl: freezed == eventsUrl + ? _self.eventsUrl + : eventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + receivedEventsUrl: freezed == receivedEventsUrl + ? _self.receivedEventsUrl + : receivedEventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + userViewType: freezed == userViewType + ? _self.userViewType + : userViewType // ignore: cast_nullable_to_non_nullable + as String?, + siteAdmin: freezed == siteAdmin + ? _self.siteAdmin + : siteAdmin // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Uploader implements Uploader { + const _Uploader( + {this.login, this.id, @JsonKey(name: 'node_id') this.nodeId, @JsonKey( + name: 'avatar_url') this.avatarUrl, @JsonKey( + name: 'gravatar_id') this.gravatarId, this.url, @JsonKey( + name: 'html_url') this.htmlUrl, @JsonKey( + name: 'followers_url') this.followersUrl, @JsonKey( + name: 'following_url') this.followingUrl, @JsonKey( + name: 'gists_url') this.gistsUrl, @JsonKey( + name: 'starred_url') this.starredUrl, @JsonKey( + name: 'subscriptions_url') this.subscriptionsUrl, @JsonKey( + name: 'organizations_url') this.organizationsUrl, @JsonKey( + name: 'repos_url') this.reposUrl, @JsonKey( + name: 'events_url') this.eventsUrl, @JsonKey( + name: 'received_events_url') this.receivedEventsUrl, this.type, @JsonKey( + name: 'user_view_type') this.userViewType, @JsonKey( + name: 'site_admin') this.siteAdmin}); + + factory _Uploader.fromJson(Map json) => + _$UploaderFromJson(json); + + @override final String? login; + @override final int? id; + @override + @JsonKey(name: 'node_id') + final String? nodeId; + @override + @JsonKey(name: 'avatar_url') + final String? avatarUrl; + @override + @JsonKey(name: 'gravatar_id') + final String? gravatarId; + @override final String? url; + @override + @JsonKey(name: 'html_url') + final String? htmlUrl; + @override + @JsonKey(name: 'followers_url') + final String? followersUrl; + @override + @JsonKey(name: 'following_url') + final String? followingUrl; + @override + @JsonKey(name: 'gists_url') + final String? gistsUrl; + @override + @JsonKey(name: 'starred_url') + final String? starredUrl; + @override + @JsonKey(name: 'subscriptions_url') + final String? subscriptionsUrl; + @override + @JsonKey(name: 'organizations_url') + final String? organizationsUrl; + @override + @JsonKey(name: 'repos_url') + final String? reposUrl; + @override + @JsonKey(name: 'events_url') + final String? eventsUrl; + @override + @JsonKey(name: 'received_events_url') + final String? receivedEventsUrl; + @override final String? type; + @override + @JsonKey(name: 'user_view_type') + final String? userViewType; + @override + @JsonKey(name: 'site_admin') + final bool? siteAdmin; + + /// Create a copy of Uploader + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UploaderCopyWith<_Uploader> get copyWith => + __$UploaderCopyWithImpl<_Uploader>(this, _$identity); + + @override + Map toJson() { + return _$UploaderToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Uploader && + (identical(other.login, login) || other.login == login) && + (identical(other.id, id) || other.id == id) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.avatarUrl, avatarUrl) || + other.avatarUrl == avatarUrl) && + (identical(other.gravatarId, gravatarId) || + other.gravatarId == gravatarId) && + (identical(other.url, url) || other.url == url) && + (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && + (identical(other.followersUrl, followersUrl) || + other.followersUrl == followersUrl) && + (identical(other.followingUrl, followingUrl) || + other.followingUrl == followingUrl) && + (identical(other.gistsUrl, gistsUrl) || + other.gistsUrl == gistsUrl) && + (identical(other.starredUrl, starredUrl) || + other.starredUrl == starredUrl) && + (identical(other.subscriptionsUrl, subscriptionsUrl) || + other.subscriptionsUrl == subscriptionsUrl) && + (identical(other.organizationsUrl, organizationsUrl) || + other.organizationsUrl == organizationsUrl) && + (identical(other.reposUrl, reposUrl) || + other.reposUrl == reposUrl) && + (identical(other.eventsUrl, eventsUrl) || + other.eventsUrl == eventsUrl) && + (identical(other.receivedEventsUrl, receivedEventsUrl) || + other.receivedEventsUrl == receivedEventsUrl) && + (identical(other.type, type) || other.type == type) && + (identical(other.userViewType, userViewType) || + other.userViewType == userViewType) && + (identical(other.siteAdmin, siteAdmin) || + other.siteAdmin == siteAdmin)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hashAll([ + runtimeType, + login, + id, + nodeId, + avatarUrl, + gravatarId, + url, + htmlUrl, + followersUrl, + followingUrl, + gistsUrl, + starredUrl, + subscriptionsUrl, + organizationsUrl, + reposUrl, + eventsUrl, + receivedEventsUrl, + type, + userViewType, + siteAdmin + ]); + + @override + String toString() { + return 'Uploader(login: $login, id: $id, nodeId: $nodeId, avatarUrl: $avatarUrl, gravatarId: $gravatarId, url: $url, htmlUrl: $htmlUrl, followersUrl: $followersUrl, followingUrl: $followingUrl, gistsUrl: $gistsUrl, starredUrl: $starredUrl, subscriptionsUrl: $subscriptionsUrl, organizationsUrl: $organizationsUrl, reposUrl: $reposUrl, eventsUrl: $eventsUrl, receivedEventsUrl: $receivedEventsUrl, type: $type, userViewType: $userViewType, siteAdmin: $siteAdmin)'; + } + + +} + +/// @nodoc +abstract mixin class _$UploaderCopyWith<$Res> + implements $UploaderCopyWith<$Res> { + factory _$UploaderCopyWith(_Uploader value, + $Res Function(_Uploader) _then) = __$UploaderCopyWithImpl; + + @override + @useResult + $Res call({ + String? login, int? id, @JsonKey(name: 'node_id') String? nodeId, @JsonKey( + name: 'avatar_url') String? avatarUrl, @JsonKey( + name: 'gravatar_id') String? gravatarId, String? url, @JsonKey( + name: 'html_url') String? htmlUrl, @JsonKey( + name: 'followers_url') String? followersUrl, @JsonKey( + name: 'following_url') String? followingUrl, @JsonKey( + name: 'gists_url') String? gistsUrl, @JsonKey( + name: 'starred_url') String? starredUrl, @JsonKey( + name: 'subscriptions_url') String? subscriptionsUrl, @JsonKey( + name: 'organizations_url') String? organizationsUrl, @JsonKey( + name: 'repos_url') String? reposUrl, @JsonKey( + name: 'events_url') String? eventsUrl, @JsonKey( + name: 'received_events_url') String? receivedEventsUrl, String? type, @JsonKey( + name: 'user_view_type') String? userViewType, @JsonKey( + name: 'site_admin') bool? siteAdmin + }); + + +} + +/// @nodoc +class __$UploaderCopyWithImpl<$Res> + implements _$UploaderCopyWith<$Res> { + __$UploaderCopyWithImpl(this._self, this._then); + + final _Uploader _self; + final $Res Function(_Uploader) _then; + + /// Create a copy of Uploader + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? login = freezed, Object? id = freezed, Object? nodeId = freezed, Object? avatarUrl = freezed, Object? gravatarId = freezed, Object? url = freezed, Object? htmlUrl = freezed, Object? followersUrl = freezed, Object? followingUrl = freezed, Object? gistsUrl = freezed, Object? starredUrl = freezed, Object? subscriptionsUrl = freezed, Object? organizationsUrl = freezed, Object? reposUrl = freezed, Object? eventsUrl = freezed, Object? receivedEventsUrl = freezed, Object? type = freezed, Object? userViewType = freezed, Object? siteAdmin = freezed,}) { + return _then(_Uploader( + login: freezed == login + ? _self.login + : login // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + avatarUrl: freezed == avatarUrl + ? _self.avatarUrl + : avatarUrl // ignore: cast_nullable_to_non_nullable + as String?, + gravatarId: freezed == gravatarId + ? _self.gravatarId + : gravatarId // ignore: cast_nullable_to_non_nullable + as String?, + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + htmlUrl: freezed == htmlUrl + ? _self.htmlUrl + : htmlUrl // ignore: cast_nullable_to_non_nullable + as String?, + followersUrl: freezed == followersUrl + ? _self.followersUrl + : followersUrl // ignore: cast_nullable_to_non_nullable + as String?, + followingUrl: freezed == followingUrl + ? _self.followingUrl + : followingUrl // ignore: cast_nullable_to_non_nullable + as String?, + gistsUrl: freezed == gistsUrl + ? _self.gistsUrl + : gistsUrl // ignore: cast_nullable_to_non_nullable + as String?, + starredUrl: freezed == starredUrl + ? _self.starredUrl + : starredUrl // ignore: cast_nullable_to_non_nullable + as String?, + subscriptionsUrl: freezed == subscriptionsUrl + ? _self.subscriptionsUrl + : subscriptionsUrl // ignore: cast_nullable_to_non_nullable + as String?, + organizationsUrl: freezed == organizationsUrl + ? _self.organizationsUrl + : organizationsUrl // ignore: cast_nullable_to_non_nullable + as String?, + reposUrl: freezed == reposUrl + ? _self.reposUrl + : reposUrl // ignore: cast_nullable_to_non_nullable + as String?, + eventsUrl: freezed == eventsUrl + ? _self.eventsUrl + : eventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + receivedEventsUrl: freezed == receivedEventsUrl + ? _self.receivedEventsUrl + : receivedEventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + userViewType: freezed == userViewType + ? _self.userViewType + : userViewType // ignore: cast_nullable_to_non_nullable + as String?, + siteAdmin: freezed == siteAdmin + ? _self.siteAdmin + : siteAdmin // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } + + +} + + +/// @nodoc +mixin _$Author { + + String? get login; + + int? get id; + + @JsonKey(name: 'node_id') String? get nodeId; + + @JsonKey(name: 'avatar_url') String? get avatarUrl; + + @JsonKey(name: 'gravatar_id') String? get gravatarId; + + String? get url; + + @JsonKey(name: 'html_url') String? get htmlUrl; + + @JsonKey(name: 'followers_url') String? get followersUrl; + + @JsonKey(name: 'following_url') String? get followingUrl; + + @JsonKey(name: 'gists_url') String? get gistsUrl; + + @JsonKey(name: 'starred_url') String? get starredUrl; + + @JsonKey(name: 'subscriptions_url') String? get subscriptionsUrl; + + @JsonKey(name: 'organizations_url') String? get organizationsUrl; + + @JsonKey(name: 'repos_url') String? get reposUrl; + + @JsonKey(name: 'events_url') String? get eventsUrl; + + @JsonKey(name: 'received_events_url') String? get receivedEventsUrl; + + String? get type; + + @JsonKey(name: 'user_view_type') String? get userViewType; + + @JsonKey(name: 'site_admin') bool? get siteAdmin; + + /// Create a copy of Author + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $AuthorCopyWith get copyWith => + _$AuthorCopyWithImpl(this as Author, _$identity); + + /// Serializes this Author to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Author && + (identical(other.login, login) || other.login == login) && + (identical(other.id, id) || other.id == id) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.avatarUrl, avatarUrl) || + other.avatarUrl == avatarUrl) && + (identical(other.gravatarId, gravatarId) || + other.gravatarId == gravatarId) && + (identical(other.url, url) || other.url == url) && + (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && + (identical(other.followersUrl, followersUrl) || + other.followersUrl == followersUrl) && + (identical(other.followingUrl, followingUrl) || + other.followingUrl == followingUrl) && + (identical(other.gistsUrl, gistsUrl) || + other.gistsUrl == gistsUrl) && + (identical(other.starredUrl, starredUrl) || + other.starredUrl == starredUrl) && + (identical(other.subscriptionsUrl, subscriptionsUrl) || + other.subscriptionsUrl == subscriptionsUrl) && + (identical(other.organizationsUrl, organizationsUrl) || + other.organizationsUrl == organizationsUrl) && + (identical(other.reposUrl, reposUrl) || + other.reposUrl == reposUrl) && + (identical(other.eventsUrl, eventsUrl) || + other.eventsUrl == eventsUrl) && + (identical(other.receivedEventsUrl, receivedEventsUrl) || + other.receivedEventsUrl == receivedEventsUrl) && + (identical(other.type, type) || other.type == type) && + (identical(other.userViewType, userViewType) || + other.userViewType == userViewType) && + (identical(other.siteAdmin, siteAdmin) || + other.siteAdmin == siteAdmin)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hashAll([ + runtimeType, + login, + id, + nodeId, + avatarUrl, + gravatarId, + url, + htmlUrl, + followersUrl, + followingUrl, + gistsUrl, + starredUrl, + subscriptionsUrl, + organizationsUrl, + reposUrl, + eventsUrl, + receivedEventsUrl, + type, + userViewType, + siteAdmin + ]); + + @override + String toString() { + return 'Author(login: $login, id: $id, nodeId: $nodeId, avatarUrl: $avatarUrl, gravatarId: $gravatarId, url: $url, htmlUrl: $htmlUrl, followersUrl: $followersUrl, followingUrl: $followingUrl, gistsUrl: $gistsUrl, starredUrl: $starredUrl, subscriptionsUrl: $subscriptionsUrl, organizationsUrl: $organizationsUrl, reposUrl: $reposUrl, eventsUrl: $eventsUrl, receivedEventsUrl: $receivedEventsUrl, type: $type, userViewType: $userViewType, siteAdmin: $siteAdmin)'; + } + + +} + +/// @nodoc +abstract mixin class $AuthorCopyWith<$Res> { + factory $AuthorCopyWith(Author value, + $Res Function(Author) _then) = _$AuthorCopyWithImpl; + + @useResult + $Res call({ + String? login, int? id, @JsonKey(name: 'node_id') String? nodeId, @JsonKey( + name: 'avatar_url') String? avatarUrl, @JsonKey( + name: 'gravatar_id') String? gravatarId, String? url, @JsonKey( + name: 'html_url') String? htmlUrl, @JsonKey( + name: 'followers_url') String? followersUrl, @JsonKey( + name: 'following_url') String? followingUrl, @JsonKey( + name: 'gists_url') String? gistsUrl, @JsonKey( + name: 'starred_url') String? starredUrl, @JsonKey( + name: 'subscriptions_url') String? subscriptionsUrl, @JsonKey( + name: 'organizations_url') String? organizationsUrl, @JsonKey( + name: 'repos_url') String? reposUrl, @JsonKey( + name: 'events_url') String? eventsUrl, @JsonKey( + name: 'received_events_url') String? receivedEventsUrl, String? type, @JsonKey( + name: 'user_view_type') String? userViewType, @JsonKey( + name: 'site_admin') bool? siteAdmin + }); + + +} + +/// @nodoc +class _$AuthorCopyWithImpl<$Res> + implements $AuthorCopyWith<$Res> { + _$AuthorCopyWithImpl(this._self, this._then); + + final Author _self; + final $Res Function(Author) _then; + + /// Create a copy of Author + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? login = freezed, Object? id = freezed, Object? nodeId = freezed, Object? avatarUrl = freezed, Object? gravatarId = freezed, Object? url = freezed, Object? htmlUrl = freezed, Object? followersUrl = freezed, Object? followingUrl = freezed, Object? gistsUrl = freezed, Object? starredUrl = freezed, Object? subscriptionsUrl = freezed, Object? organizationsUrl = freezed, Object? reposUrl = freezed, Object? eventsUrl = freezed, Object? receivedEventsUrl = freezed, Object? type = freezed, Object? userViewType = freezed, Object? siteAdmin = freezed,}) { + return _then(_self.copyWith( + login: freezed == login + ? _self.login + : login // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + avatarUrl: freezed == avatarUrl + ? _self.avatarUrl + : avatarUrl // ignore: cast_nullable_to_non_nullable + as String?, + gravatarId: freezed == gravatarId + ? _self.gravatarId + : gravatarId // ignore: cast_nullable_to_non_nullable + as String?, + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + htmlUrl: freezed == htmlUrl + ? _self.htmlUrl + : htmlUrl // ignore: cast_nullable_to_non_nullable + as String?, + followersUrl: freezed == followersUrl + ? _self.followersUrl + : followersUrl // ignore: cast_nullable_to_non_nullable + as String?, + followingUrl: freezed == followingUrl + ? _self.followingUrl + : followingUrl // ignore: cast_nullable_to_non_nullable + as String?, + gistsUrl: freezed == gistsUrl + ? _self.gistsUrl + : gistsUrl // ignore: cast_nullable_to_non_nullable + as String?, + starredUrl: freezed == starredUrl + ? _self.starredUrl + : starredUrl // ignore: cast_nullable_to_non_nullable + as String?, + subscriptionsUrl: freezed == subscriptionsUrl + ? _self.subscriptionsUrl + : subscriptionsUrl // ignore: cast_nullable_to_non_nullable + as String?, + organizationsUrl: freezed == organizationsUrl + ? _self.organizationsUrl + : organizationsUrl // ignore: cast_nullable_to_non_nullable + as String?, + reposUrl: freezed == reposUrl + ? _self.reposUrl + : reposUrl // ignore: cast_nullable_to_non_nullable + as String?, + eventsUrl: freezed == eventsUrl + ? _self.eventsUrl + : eventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + receivedEventsUrl: freezed == receivedEventsUrl + ? _self.receivedEventsUrl + : receivedEventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + userViewType: freezed == userViewType + ? _self.userViewType + : userViewType // ignore: cast_nullable_to_non_nullable + as String?, + siteAdmin: freezed == siteAdmin + ? _self.siteAdmin + : siteAdmin // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Author implements Author { + const _Author( + {this.login, this.id, @JsonKey(name: 'node_id') this.nodeId, @JsonKey( + name: 'avatar_url') this.avatarUrl, @JsonKey( + name: 'gravatar_id') this.gravatarId, this.url, @JsonKey( + name: 'html_url') this.htmlUrl, @JsonKey( + name: 'followers_url') this.followersUrl, @JsonKey( + name: 'following_url') this.followingUrl, @JsonKey( + name: 'gists_url') this.gistsUrl, @JsonKey( + name: 'starred_url') this.starredUrl, @JsonKey( + name: 'subscriptions_url') this.subscriptionsUrl, @JsonKey( + name: 'organizations_url') this.organizationsUrl, @JsonKey( + name: 'repos_url') this.reposUrl, @JsonKey( + name: 'events_url') this.eventsUrl, @JsonKey( + name: 'received_events_url') this.receivedEventsUrl, this.type, @JsonKey( + name: 'user_view_type') this.userViewType, @JsonKey( + name: 'site_admin') this.siteAdmin}); + + factory _Author.fromJson(Map json) => _$AuthorFromJson(json); + + @override final String? login; + @override final int? id; + @override + @JsonKey(name: 'node_id') + final String? nodeId; + @override + @JsonKey(name: 'avatar_url') + final String? avatarUrl; + @override + @JsonKey(name: 'gravatar_id') + final String? gravatarId; + @override final String? url; + @override + @JsonKey(name: 'html_url') + final String? htmlUrl; + @override + @JsonKey(name: 'followers_url') + final String? followersUrl; + @override + @JsonKey(name: 'following_url') + final String? followingUrl; + @override + @JsonKey(name: 'gists_url') + final String? gistsUrl; + @override + @JsonKey(name: 'starred_url') + final String? starredUrl; + @override + @JsonKey(name: 'subscriptions_url') + final String? subscriptionsUrl; + @override + @JsonKey(name: 'organizations_url') + final String? organizationsUrl; + @override + @JsonKey(name: 'repos_url') + final String? reposUrl; + @override + @JsonKey(name: 'events_url') + final String? eventsUrl; + @override + @JsonKey(name: 'received_events_url') + final String? receivedEventsUrl; + @override final String? type; + @override + @JsonKey(name: 'user_view_type') + final String? userViewType; + @override + @JsonKey(name: 'site_admin') + final bool? siteAdmin; + + /// Create a copy of Author + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$AuthorCopyWith<_Author> get copyWith => + __$AuthorCopyWithImpl<_Author>(this, _$identity); + + @override + Map toJson() { + return _$AuthorToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Author && + (identical(other.login, login) || other.login == login) && + (identical(other.id, id) || other.id == id) && + (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && + (identical(other.avatarUrl, avatarUrl) || + other.avatarUrl == avatarUrl) && + (identical(other.gravatarId, gravatarId) || + other.gravatarId == gravatarId) && + (identical(other.url, url) || other.url == url) && + (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && + (identical(other.followersUrl, followersUrl) || + other.followersUrl == followersUrl) && + (identical(other.followingUrl, followingUrl) || + other.followingUrl == followingUrl) && + (identical(other.gistsUrl, gistsUrl) || + other.gistsUrl == gistsUrl) && + (identical(other.starredUrl, starredUrl) || + other.starredUrl == starredUrl) && + (identical(other.subscriptionsUrl, subscriptionsUrl) || + other.subscriptionsUrl == subscriptionsUrl) && + (identical(other.organizationsUrl, organizationsUrl) || + other.organizationsUrl == organizationsUrl) && + (identical(other.reposUrl, reposUrl) || + other.reposUrl == reposUrl) && + (identical(other.eventsUrl, eventsUrl) || + other.eventsUrl == eventsUrl) && + (identical(other.receivedEventsUrl, receivedEventsUrl) || + other.receivedEventsUrl == receivedEventsUrl) && + (identical(other.type, type) || other.type == type) && + (identical(other.userViewType, userViewType) || + other.userViewType == userViewType) && + (identical(other.siteAdmin, siteAdmin) || + other.siteAdmin == siteAdmin)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hashAll([ + runtimeType, + login, + id, + nodeId, + avatarUrl, + gravatarId, + url, + htmlUrl, + followersUrl, + followingUrl, + gistsUrl, + starredUrl, + subscriptionsUrl, + organizationsUrl, + reposUrl, + eventsUrl, + receivedEventsUrl, + type, + userViewType, + siteAdmin + ]); + + @override + String toString() { + return 'Author(login: $login, id: $id, nodeId: $nodeId, avatarUrl: $avatarUrl, gravatarId: $gravatarId, url: $url, htmlUrl: $htmlUrl, followersUrl: $followersUrl, followingUrl: $followingUrl, gistsUrl: $gistsUrl, starredUrl: $starredUrl, subscriptionsUrl: $subscriptionsUrl, organizationsUrl: $organizationsUrl, reposUrl: $reposUrl, eventsUrl: $eventsUrl, receivedEventsUrl: $receivedEventsUrl, type: $type, userViewType: $userViewType, siteAdmin: $siteAdmin)'; + } + + +} + +/// @nodoc +abstract mixin class _$AuthorCopyWith<$Res> implements $AuthorCopyWith<$Res> { + factory _$AuthorCopyWith(_Author value, + $Res Function(_Author) _then) = __$AuthorCopyWithImpl; + + @override + @useResult + $Res call({ + String? login, int? id, @JsonKey(name: 'node_id') String? nodeId, @JsonKey( + name: 'avatar_url') String? avatarUrl, @JsonKey( + name: 'gravatar_id') String? gravatarId, String? url, @JsonKey( + name: 'html_url') String? htmlUrl, @JsonKey( + name: 'followers_url') String? followersUrl, @JsonKey( + name: 'following_url') String? followingUrl, @JsonKey( + name: 'gists_url') String? gistsUrl, @JsonKey( + name: 'starred_url') String? starredUrl, @JsonKey( + name: 'subscriptions_url') String? subscriptionsUrl, @JsonKey( + name: 'organizations_url') String? organizationsUrl, @JsonKey( + name: 'repos_url') String? reposUrl, @JsonKey( + name: 'events_url') String? eventsUrl, @JsonKey( + name: 'received_events_url') String? receivedEventsUrl, String? type, @JsonKey( + name: 'user_view_type') String? userViewType, @JsonKey( + name: 'site_admin') bool? siteAdmin + }); + + +} + +/// @nodoc +class __$AuthorCopyWithImpl<$Res> + implements _$AuthorCopyWith<$Res> { + __$AuthorCopyWithImpl(this._self, this._then); + + final _Author _self; + final $Res Function(_Author) _then; + + /// Create a copy of Author + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? login = freezed, Object? id = freezed, Object? nodeId = freezed, Object? avatarUrl = freezed, Object? gravatarId = freezed, Object? url = freezed, Object? htmlUrl = freezed, Object? followersUrl = freezed, Object? followingUrl = freezed, Object? gistsUrl = freezed, Object? starredUrl = freezed, Object? subscriptionsUrl = freezed, Object? organizationsUrl = freezed, Object? reposUrl = freezed, Object? eventsUrl = freezed, Object? receivedEventsUrl = freezed, Object? type = freezed, Object? userViewType = freezed, Object? siteAdmin = freezed,}) { + return _then(_Author( + login: freezed == login + ? _self.login + : login // ignore: cast_nullable_to_non_nullable + as String?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + nodeId: freezed == nodeId + ? _self.nodeId + : nodeId // ignore: cast_nullable_to_non_nullable + as String?, + avatarUrl: freezed == avatarUrl + ? _self.avatarUrl + : avatarUrl // ignore: cast_nullable_to_non_nullable + as String?, + gravatarId: freezed == gravatarId + ? _self.gravatarId + : gravatarId // ignore: cast_nullable_to_non_nullable + as String?, + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + htmlUrl: freezed == htmlUrl + ? _self.htmlUrl + : htmlUrl // ignore: cast_nullable_to_non_nullable + as String?, + followersUrl: freezed == followersUrl + ? _self.followersUrl + : followersUrl // ignore: cast_nullable_to_non_nullable + as String?, + followingUrl: freezed == followingUrl + ? _self.followingUrl + : followingUrl // ignore: cast_nullable_to_non_nullable + as String?, + gistsUrl: freezed == gistsUrl + ? _self.gistsUrl + : gistsUrl // ignore: cast_nullable_to_non_nullable + as String?, + starredUrl: freezed == starredUrl + ? _self.starredUrl + : starredUrl // ignore: cast_nullable_to_non_nullable + as String?, + subscriptionsUrl: freezed == subscriptionsUrl + ? _self.subscriptionsUrl + : subscriptionsUrl // ignore: cast_nullable_to_non_nullable + as String?, + organizationsUrl: freezed == organizationsUrl + ? _self.organizationsUrl + : organizationsUrl // ignore: cast_nullable_to_non_nullable + as String?, + reposUrl: freezed == reposUrl + ? _self.reposUrl + : reposUrl // ignore: cast_nullable_to_non_nullable + as String?, + eventsUrl: freezed == eventsUrl + ? _self.eventsUrl + : eventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + receivedEventsUrl: freezed == receivedEventsUrl + ? _self.receivedEventsUrl + : receivedEventsUrl // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + userViewType: freezed == userViewType + ? _self.userViewType + : userViewType // ignore: cast_nullable_to_non_nullable + as String?, + siteAdmin: freezed == siteAdmin + ? _self.siteAdmin + : siteAdmin // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } + + +} + +// dart format on diff --git a/lib/common/models/github.g.dart b/lib/common/models/github.g.dart new file mode 100644 index 0000000..55c4a06 --- /dev/null +++ b/lib/common/models/github.g.dart @@ -0,0 +1,183 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'github.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_GithubRelease _$GithubReleaseFromJson(Map json) => + _GithubRelease( + url: json['url'] as String?, + assetsUrl: json['assets_url'] as String?, + uploadUrl: json['upload_url'] as String?, + htmlUrl: json['html_url'] as String?, + id: (json['id'] as num?)?.toInt(), + author: + json['author'] == null + ? null + : Author.fromJson(json['author'] as Map), + nodeId: json['node_id'] as String?, + tagName: json['tag_name'] as String?, + targetCommitish: json['target_commitish'] as String?, + name: json['name'] as String?, + draft: json['draft'] as bool?, + prerelease: json['prerelease'] as bool?, + createdAt: json['created_at'] as String?, + publishedAt: json['published_at'] as String?, + assets: + (json['assets'] as List?) + ?.map((e) => Assets.fromJson(e as Map)) + .toList(), + tarballUrl: json['tarball_url'] as String?, + zipballUrl: json['zipball_url'] as String?, + body: json['body'] as String?, + ); + +Map _$GithubReleaseToJson(_GithubRelease instance) => + { + if (instance.url case final value?) 'url': value, + if (instance.assetsUrl case final value?) 'assets_url': value, + if (instance.uploadUrl case final value?) 'upload_url': value, + if (instance.htmlUrl case final value?) 'html_url': value, + if (instance.id case final value?) 'id': value, + if (instance.author case final value?) 'author': value, + if (instance.nodeId case final value?) 'node_id': value, + if (instance.tagName case final value?) 'tag_name': value, + if (instance.targetCommitish case final value?) 'target_commitish': value, + if (instance.name case final value?) 'name': value, + if (instance.draft case final value?) 'draft': value, + if (instance.prerelease case final value?) 'prerelease': value, + if (instance.createdAt case final value?) 'created_at': value, + if (instance.publishedAt case final value?) 'published_at': value, + if (instance.assets case final value?) 'assets': value, + if (instance.tarballUrl case final value?) 'tarball_url': value, + if (instance.zipballUrl case final value?) 'zipball_url': value, + if (instance.body case final value?) 'body': value, + }; + +_Assets _$AssetsFromJson(Map json) => _Assets( + url: json['url'] as String?, + id: (json['id'] as num?)?.toInt(), + nodeId: json['node_id'] as String?, + name: json['name'] as String?, + label: json['label'], + uploader: + json['uploader'] == null + ? null + : Uploader.fromJson(json['uploader'] as Map), + contentType: json['content_type'] as String?, + state: json['state'] as String?, + size: (json['size'] as num?)?.toInt(), + downloadCount: (json['download_count'] as num?)?.toInt(), + createdAt: json['created_at'] as String?, + updatedAt: json['updated_at'] as String?, + browserDownloadUrl: json['browser_download_url'] as String?, +); + +Map _$AssetsToJson(_Assets instance) => { + if (instance.url case final value?) 'url': value, + if (instance.id case final value?) 'id': value, + if (instance.nodeId case final value?) 'node_id': value, + if (instance.name case final value?) 'name': value, + if (instance.label case final value?) 'label': value, + if (instance.uploader case final value?) 'uploader': value, + if (instance.contentType case final value?) 'content_type': value, + if (instance.state case final value?) 'state': value, + if (instance.size case final value?) 'size': value, + if (instance.downloadCount case final value?) 'download_count': value, + if (instance.createdAt case final value?) 'created_at': value, + if (instance.updatedAt case final value?) 'updated_at': value, + if (instance.browserDownloadUrl case final value?) + 'browser_download_url': value, +}; + +_Uploader _$UploaderFromJson(Map json) => _Uploader( + login: json['login'] as String?, + id: (json['id'] as num?)?.toInt(), + nodeId: json['node_id'] as String?, + avatarUrl: json['avatar_url'] as String?, + gravatarId: json['gravatar_id'] as String?, + url: json['url'] as String?, + htmlUrl: json['html_url'] as String?, + followersUrl: json['followers_url'] as String?, + followingUrl: json['following_url'] as String?, + gistsUrl: json['gists_url'] as String?, + starredUrl: json['starred_url'] as String?, + subscriptionsUrl: json['subscriptions_url'] as String?, + organizationsUrl: json['organizations_url'] as String?, + reposUrl: json['repos_url'] as String?, + eventsUrl: json['events_url'] as String?, + receivedEventsUrl: json['received_events_url'] as String?, + type: json['type'] as String?, + userViewType: json['user_view_type'] as String?, + siteAdmin: json['site_admin'] as bool?, +); + +Map _$UploaderToJson(_Uploader instance) => { + if (instance.login case final value?) 'login': value, + if (instance.id case final value?) 'id': value, + if (instance.nodeId case final value?) 'node_id': value, + if (instance.avatarUrl case final value?) 'avatar_url': value, + if (instance.gravatarId case final value?) 'gravatar_id': value, + if (instance.url case final value?) 'url': value, + if (instance.htmlUrl case final value?) 'html_url': value, + if (instance.followersUrl case final value?) 'followers_url': value, + if (instance.followingUrl case final value?) 'following_url': value, + if (instance.gistsUrl case final value?) 'gists_url': value, + if (instance.starredUrl case final value?) 'starred_url': value, + if (instance.subscriptionsUrl case final value?) 'subscriptions_url': value, + if (instance.organizationsUrl case final value?) 'organizations_url': value, + if (instance.reposUrl case final value?) 'repos_url': value, + if (instance.eventsUrl case final value?) 'events_url': value, + if (instance.receivedEventsUrl case final value?) + 'received_events_url': value, + if (instance.type case final value?) 'type': value, + if (instance.userViewType case final value?) 'user_view_type': value, + if (instance.siteAdmin case final value?) 'site_admin': value, +}; + +_Author _$AuthorFromJson(Map json) => _Author( + login: json['login'] as String?, + id: (json['id'] as num?)?.toInt(), + nodeId: json['node_id'] as String?, + avatarUrl: json['avatar_url'] as String?, + gravatarId: json['gravatar_id'] as String?, + url: json['url'] as String?, + htmlUrl: json['html_url'] as String?, + followersUrl: json['followers_url'] as String?, + followingUrl: json['following_url'] as String?, + gistsUrl: json['gists_url'] as String?, + starredUrl: json['starred_url'] as String?, + subscriptionsUrl: json['subscriptions_url'] as String?, + organizationsUrl: json['organizations_url'] as String?, + reposUrl: json['repos_url'] as String?, + eventsUrl: json['events_url'] as String?, + receivedEventsUrl: json['received_events_url'] as String?, + type: json['type'] as String?, + userViewType: json['user_view_type'] as String?, + siteAdmin: json['site_admin'] as bool?, +); + +Map _$AuthorToJson(_Author instance) => { + if (instance.login case final value?) 'login': value, + if (instance.id case final value?) 'id': value, + if (instance.nodeId case final value?) 'node_id': value, + if (instance.avatarUrl case final value?) 'avatar_url': value, + if (instance.gravatarId case final value?) 'gravatar_id': value, + if (instance.url case final value?) 'url': value, + if (instance.htmlUrl case final value?) 'html_url': value, + if (instance.followersUrl case final value?) 'followers_url': value, + if (instance.followingUrl case final value?) 'following_url': value, + if (instance.gistsUrl case final value?) 'gists_url': value, + if (instance.starredUrl case final value?) 'starred_url': value, + if (instance.subscriptionsUrl case final value?) 'subscriptions_url': value, + if (instance.organizationsUrl case final value?) 'organizations_url': value, + if (instance.reposUrl case final value?) 'repos_url': value, + if (instance.eventsUrl case final value?) 'events_url': value, + if (instance.receivedEventsUrl case final value?) + 'received_events_url': value, + if (instance.type case final value?) 'type': value, + if (instance.userViewType case final value?) 'user_view_type': value, + if (instance.siteAdmin case final value?) 'site_admin': value, +}; diff --git a/lib/common/models/hitokoto.dart b/lib/common/models/hitokoto.dart index 1ea54a5..2a4fe0f 100644 --- a/lib/common/models/hitokoto.dart +++ b/lib/common/models/hitokoto.dart @@ -1,61 +1,25 @@ -class HitokotoResponse { - int? id; - String? uuid; - String? hitokoto; - String? type; - String? from; - String? fromWho; - String? creator; - int? creatorUid; - int? reviewer; - String? commitFrom; - String? createdAt; - int? length; +import 'package:freezed_annotation/freezed_annotation.dart'; - HitokotoResponse({ - this.id, - this.uuid, - this.hitokoto, - this.type, - this.from, - this.fromWho, - this.creator, - this.creatorUid, - this.reviewer, - this.commitFrom, - this.createdAt, - this.length, - }); +part 'hitokoto.freezed.dart'; +part 'hitokoto.g.dart'; - HitokotoResponse.fromJson(Map json) { - id = json["id"]; - uuid = json["uuid"]; - hitokoto = json["hitokoto"]; - type = json["type"]; - from = json["from"]; - fromWho = json["from_who"]; - creator = json["creator"]; - creatorUid = json["creator_uid"]; - reviewer = json["reviewer"]; - commitFrom = json["commit_from"]; - createdAt = json["created_at"]; - length = json["length"]; - } +@freezed +abstract class HitokotoResponse with _$HitokotoResponse { + const factory HitokotoResponse({ + int? id, + String? uuid, + String? hitokoto, + String? type, + String? from, + @JsonKey(name: 'from_who') String? fromWho, + String? creator, + @JsonKey(name: 'creator_uid') int? creatorUid, + int? reviewer, + @JsonKey(name: 'commit_from') String? commitFrom, + @JsonKey(name: 'created_at') String? createdAt, + int? length, + }) = _HitokotoResponse; - Map toJson() { - final Map data = {}; - data["id"] = id; - data["uuid"] = uuid; - data["hitokoto"] = hitokoto; - data["type"] = type; - data["from"] = from; - data["from_who"] = fromWho; - data["creator"] = creator; - data["creator_uid"] = creatorUid; - data["reviewer"] = reviewer; - data["commit_from"] = commitFrom; - data["created_at"] = createdAt; - data["length"] = length; - return data; - } + factory HitokotoResponse.fromJson(Map json) => + _$HitokotoResponseFromJson(json); } diff --git a/lib/common/models/hitokoto.freezed.dart b/lib/common/models/hitokoto.freezed.dart new file mode 100644 index 0000000..9d84cfe --- /dev/null +++ b/lib/common/models/hitokoto.freezed.dart @@ -0,0 +1,370 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'hitokoto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$HitokotoResponse { + + int? get id; + + String? get uuid; + + String? get hitokoto; + + String? get type; + + String? get from; + + @JsonKey(name: 'from_who') String? get fromWho; + + String? get creator; + + @JsonKey(name: 'creator_uid') int? get creatorUid; + + int? get reviewer; + + @JsonKey(name: 'commit_from') String? get commitFrom; + + @JsonKey(name: 'created_at') String? get createdAt; + + int? get length; + + /// Create a copy of HitokotoResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $HitokotoResponseCopyWith get copyWith => + _$HitokotoResponseCopyWithImpl( + this as HitokotoResponse, _$identity); + + /// Serializes this HitokotoResponse to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is HitokotoResponse && + (identical(other.id, id) || other.id == id) && + (identical(other.uuid, uuid) || other.uuid == uuid) && + (identical(other.hitokoto, hitokoto) || + other.hitokoto == hitokoto) && + (identical(other.type, type) || other.type == type) && + (identical(other.from, from) || other.from == from) && + (identical(other.fromWho, fromWho) || other.fromWho == fromWho) && + (identical(other.creator, creator) || other.creator == creator) && + (identical(other.creatorUid, creatorUid) || + other.creatorUid == creatorUid) && + (identical(other.reviewer, reviewer) || + other.reviewer == reviewer) && + (identical(other.commitFrom, commitFrom) || + other.commitFrom == commitFrom) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.length, length) || other.length == length)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + id, + uuid, + hitokoto, + type, + from, + fromWho, + creator, + creatorUid, + reviewer, + commitFrom, + createdAt, + length); + + @override + String toString() { + return 'HitokotoResponse(id: $id, uuid: $uuid, hitokoto: $hitokoto, type: $type, from: $from, fromWho: $fromWho, creator: $creator, creatorUid: $creatorUid, reviewer: $reviewer, commitFrom: $commitFrom, createdAt: $createdAt, length: $length)'; + } + + +} + +/// @nodoc +abstract mixin class $HitokotoResponseCopyWith<$Res> { + factory $HitokotoResponseCopyWith(HitokotoResponse value, + $Res Function(HitokotoResponse) _then) = _$HitokotoResponseCopyWithImpl; + + @useResult + $Res call({ + int? id, String? uuid, String? hitokoto, String? type, String? from, @JsonKey( + name: 'from_who') String? fromWho, String? creator, @JsonKey( + name: 'creator_uid') int? creatorUid, int? reviewer, @JsonKey( + name: 'commit_from') String? commitFrom, @JsonKey( + name: 'created_at') String? createdAt, int? length + }); + + +} + +/// @nodoc +class _$HitokotoResponseCopyWithImpl<$Res> + implements $HitokotoResponseCopyWith<$Res> { + _$HitokotoResponseCopyWithImpl(this._self, this._then); + + final HitokotoResponse _self; + final $Res Function(HitokotoResponse) _then; + + /// Create a copy of HitokotoResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? id = freezed, Object? uuid = freezed, Object? hitokoto = freezed, Object? type = freezed, Object? from = freezed, Object? fromWho = freezed, Object? creator = freezed, Object? creatorUid = freezed, Object? reviewer = freezed, Object? commitFrom = freezed, Object? createdAt = freezed, Object? length = freezed,}) { + return _then(_self.copyWith( + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + uuid: freezed == uuid + ? _self.uuid + : uuid // ignore: cast_nullable_to_non_nullable + as String?, + hitokoto: freezed == hitokoto + ? _self.hitokoto + : hitokoto // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + from: freezed == from + ? _self.from + : from // ignore: cast_nullable_to_non_nullable + as String?, + fromWho: freezed == fromWho + ? _self.fromWho + : fromWho // ignore: cast_nullable_to_non_nullable + as String?, + creator: freezed == creator + ? _self.creator + : creator // ignore: cast_nullable_to_non_nullable + as String?, + creatorUid: freezed == creatorUid + ? _self.creatorUid + : creatorUid // ignore: cast_nullable_to_non_nullable + as int?, + reviewer: freezed == reviewer + ? _self.reviewer + : reviewer // ignore: cast_nullable_to_non_nullable + as int?, + commitFrom: freezed == commitFrom + ? _self.commitFrom + : commitFrom // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + length: freezed == length + ? _self.length + : length // ignore: cast_nullable_to_non_nullable + as int?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _HitokotoResponse implements HitokotoResponse { + const _HitokotoResponse( + {this.id, this.uuid, this.hitokoto, this.type, this.from, @JsonKey( + name: 'from_who') this.fromWho, this.creator, @JsonKey( + name: 'creator_uid') this.creatorUid, this.reviewer, @JsonKey( + name: 'commit_from') this.commitFrom, @JsonKey( + name: 'created_at') this.createdAt, this.length}); + + factory _HitokotoResponse.fromJson(Map json) => + _$HitokotoResponseFromJson(json); + + @override final int? id; + @override final String? uuid; + @override final String? hitokoto; + @override final String? type; + @override final String? from; + @override + @JsonKey(name: 'from_who') + final String? fromWho; + @override final String? creator; + @override + @JsonKey(name: 'creator_uid') + final int? creatorUid; + @override final int? reviewer; + @override + @JsonKey(name: 'commit_from') + final String? commitFrom; + @override + @JsonKey(name: 'created_at') + final String? createdAt; + @override final int? length; + + /// Create a copy of HitokotoResponse + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$HitokotoResponseCopyWith<_HitokotoResponse> get copyWith => + __$HitokotoResponseCopyWithImpl<_HitokotoResponse>(this, _$identity); + + @override + Map toJson() { + return _$HitokotoResponseToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _HitokotoResponse && + (identical(other.id, id) || other.id == id) && + (identical(other.uuid, uuid) || other.uuid == uuid) && + (identical(other.hitokoto, hitokoto) || + other.hitokoto == hitokoto) && + (identical(other.type, type) || other.type == type) && + (identical(other.from, from) || other.from == from) && + (identical(other.fromWho, fromWho) || other.fromWho == fromWho) && + (identical(other.creator, creator) || other.creator == creator) && + (identical(other.creatorUid, creatorUid) || + other.creatorUid == creatorUid) && + (identical(other.reviewer, reviewer) || + other.reviewer == reviewer) && + (identical(other.commitFrom, commitFrom) || + other.commitFrom == commitFrom) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.length, length) || other.length == length)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + id, + uuid, + hitokoto, + type, + from, + fromWho, + creator, + creatorUid, + reviewer, + commitFrom, + createdAt, + length); + + @override + String toString() { + return 'HitokotoResponse(id: $id, uuid: $uuid, hitokoto: $hitokoto, type: $type, from: $from, fromWho: $fromWho, creator: $creator, creatorUid: $creatorUid, reviewer: $reviewer, commitFrom: $commitFrom, createdAt: $createdAt, length: $length)'; + } + + +} + +/// @nodoc +abstract mixin class _$HitokotoResponseCopyWith<$Res> + implements $HitokotoResponseCopyWith<$Res> { + factory _$HitokotoResponseCopyWith(_HitokotoResponse value, + $Res Function(_HitokotoResponse) _then) = __$HitokotoResponseCopyWithImpl; + + @override + @useResult + $Res call({ + int? id, String? uuid, String? hitokoto, String? type, String? from, @JsonKey( + name: 'from_who') String? fromWho, String? creator, @JsonKey( + name: 'creator_uid') int? creatorUid, int? reviewer, @JsonKey( + name: 'commit_from') String? commitFrom, @JsonKey( + name: 'created_at') String? createdAt, int? length + }); + + +} + +/// @nodoc +class __$HitokotoResponseCopyWithImpl<$Res> + implements _$HitokotoResponseCopyWith<$Res> { + __$HitokotoResponseCopyWithImpl(this._self, this._then); + + final _HitokotoResponse _self; + final $Res Function(_HitokotoResponse) _then; + + /// Create a copy of HitokotoResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? id = freezed, Object? uuid = freezed, Object? hitokoto = freezed, Object? type = freezed, Object? from = freezed, Object? fromWho = freezed, Object? creator = freezed, Object? creatorUid = freezed, Object? reviewer = freezed, Object? commitFrom = freezed, Object? createdAt = freezed, Object? length = freezed,}) { + return _then(_HitokotoResponse( + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as int?, + uuid: freezed == uuid + ? _self.uuid + : uuid // ignore: cast_nullable_to_non_nullable + as String?, + hitokoto: freezed == hitokoto + ? _self.hitokoto + : hitokoto // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _self.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + from: freezed == from + ? _self.from + : from // ignore: cast_nullable_to_non_nullable + as String?, + fromWho: freezed == fromWho + ? _self.fromWho + : fromWho // ignore: cast_nullable_to_non_nullable + as String?, + creator: freezed == creator + ? _self.creator + : creator // ignore: cast_nullable_to_non_nullable + as String?, + creatorUid: freezed == creatorUid + ? _self.creatorUid + : creatorUid // ignore: cast_nullable_to_non_nullable + as int?, + reviewer: freezed == reviewer + ? _self.reviewer + : reviewer // ignore: cast_nullable_to_non_nullable + as int?, + commitFrom: freezed == commitFrom + ? _self.commitFrom + : commitFrom // ignore: cast_nullable_to_non_nullable + as String?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + length: freezed == length + ? _self.length + : length // ignore: cast_nullable_to_non_nullable + as int?, + )); + } + + +} + +// dart format on diff --git a/lib/common/models/hitokoto.g.dart b/lib/common/models/hitokoto.g.dart new file mode 100644 index 0000000..2b59034 --- /dev/null +++ b/lib/common/models/hitokoto.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'hitokoto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_HitokotoResponse _$HitokotoResponseFromJson(Map json) => + _HitokotoResponse( + id: (json['id'] as num?)?.toInt(), + uuid: json['uuid'] as String?, + hitokoto: json['hitokoto'] as String?, + type: json['type'] as String?, + from: json['from'] as String?, + fromWho: json['from_who'] as String?, + creator: json['creator'] as String?, + creatorUid: (json['creator_uid'] as num?)?.toInt(), + reviewer: (json['reviewer'] as num?)?.toInt(), + commitFrom: json['commit_from'] as String?, + createdAt: json['created_at'] as String?, + length: (json['length'] as num?)?.toInt(), + ); + +Map _$HitokotoResponseToJson(_HitokotoResponse instance) => + { + if (instance.id case final value?) 'id': value, + if (instance.uuid case final value?) 'uuid': value, + if (instance.hitokoto case final value?) 'hitokoto': value, + if (instance.type case final value?) 'type': value, + if (instance.from case final value?) 'from': value, + if (instance.fromWho case final value?) 'from_who': value, + if (instance.creator case final value?) 'creator': value, + if (instance.creatorUid case final value?) 'creator_uid': value, + if (instance.reviewer case final value?) 'reviewer': value, + if (instance.commitFrom case final value?) 'commit_from': value, + if (instance.createdAt case final value?) 'created_at': value, + if (instance.length case final value?) 'length': value, + }; diff --git a/lib/common/models/hunyuan.dart b/lib/common/models/hunyuan.dart index fddbf83..f05655e 100644 --- a/lib/common/models/hunyuan.dart +++ b/lib/common/models/hunyuan.dart @@ -1,139 +1,74 @@ -class PublicHeader { - String? action; - int? timestamp; - String? version; - String? authorization; +import 'package:freezed_annotation/freezed_annotation.dart'; - Map toMap() { - return { - 'X-TC-Action': action, - 'X-TC-Timestamp': timestamp, - 'X-TC-Version': version, - 'Authorization': authorization, - }; - } +part 'hunyuan.freezed.dart'; +part 'hunyuan.g.dart'; - PublicHeader.fromMap(Map map) { - action = map['X-TC-Action']; - timestamp = map['X-TC-Timestamp']; - version = map['X-TC-Version']; - authorization = map['Authorization']; - } +@freezed +abstract class PublicHeader with _$PublicHeader { + const factory PublicHeader({ + @JsonKey(name: 'X-TC-Action') String? action, + @JsonKey(name: 'X-TC-Timestamp') int? timestamp, + @JsonKey(name: 'X-TC-Version') String? version, + @JsonKey(name: 'Authorization') String? authorization, + }) = _PublicHeader; - PublicHeader(this.action, this.timestamp, this.version, this.authorization); + factory PublicHeader.fromJson(Map json) => + _$PublicHeaderFromJson(json); } -class Message { - late String role; - late String content; +@freezed +abstract class Message with _$Message { + const factory Message({ + @JsonKey(name: 'Role') required String role, + @JsonKey(name: 'Content') required String content, + }) = _Message; - Message(this.role, this.content); - - Map toMap() { - return {'Role': role, 'Content': content}; - } - - Message.fromMap(Map map) { - role = map['Role']; - content = map['Content']; - } + factory Message.fromJson(Map json) => + _$MessageFromJson(json); } -class HunyuanResponse { - String? note; - List? choices; - int? created; - String? id; - Usage? usage; +@freezed +abstract class HunyuanResponse with _$HunyuanResponse { + const factory HunyuanResponse({ + @JsonKey(name: 'Note') String? note, + @JsonKey(name: 'Choices') List? choices, + @JsonKey(name: 'Created') int? created, + @JsonKey(name: 'Id') String? id, + @JsonKey(name: 'Usage') Usage? usage, + }) = _HunyuanResponse; - HunyuanResponse({this.note, this.choices, this.created, this.id, this.usage}); - - HunyuanResponse.fromJson(Map json) { - note = json["Note"]; - choices = - json["Choices"] == null - ? null - : (json["Choices"] as List) - .map((e) => Choices.fromJson(e)) - .toList(); - created = json["Created"]; - id = json["Id"]; - usage = json["Usage"] == null ? null : Usage.fromJson(json["Usage"]); - } - - Map toJson() { - final Map data = {}; - data["Note"] = note; - if (choices != null) { - data["Choices"] = choices?.map((e) => e.toJson()).toList(); - } - data["Created"] = created; - data["Id"] = id; - if (usage != null) { - data["Usage"] = usage?.toJson(); - } - return data; - } + factory HunyuanResponse.fromJson(Map json) => + _$HunyuanResponseFromJson(json); } -class Usage { - int? promptTokens; - int? completionTokens; - int? totalTokens; +@freezed +abstract class Usage with _$Usage { + const factory Usage({ + @JsonKey(name: 'PromptTokens') int? promptTokens, + @JsonKey(name: 'CompletionTokens') int? completionTokens, + @JsonKey(name: 'TotalTokens') int? totalTokens, + }) = _Usage; - Usage({this.promptTokens, this.completionTokens, this.totalTokens}); - - Usage.fromJson(Map json) { - promptTokens = json["PromptTokens"]; - completionTokens = json["CompletionTokens"]; - totalTokens = json["TotalTokens"]; - } - - Map toJson() { - final Map data = {}; - data["PromptTokens"] = promptTokens; - data["CompletionTokens"] = completionTokens; - data["TotalTokens"] = totalTokens; - return data; - } + factory Usage.fromJson(Map json) => _$UsageFromJson(json); } -class Choices { - String? finishReason; - Delta? delta; +@freezed +abstract class Choices with _$Choices { + const factory Choices({ + @JsonKey(name: 'FinishReason') String? finishReason, + @JsonKey(name: 'Delta') Delta? delta, + }) = _Choices; - Choices({this.finishReason, this.delta}); - - Choices.fromJson(Map json) { - finishReason = json["FinishReason"]; - delta = json["Delta"] == null ? null : Delta.fromJson(json["Delta"]); - } - - Map toJson() { - final Map data = {}; - data["FinishReason"] = finishReason; - if (delta != null) { - data["Delta"] = delta?.toJson(); - } - return data; - } + factory Choices.fromJson(Map json) => + _$ChoicesFromJson(json); } -class Delta { - String? role; - String? content; +@freezed +abstract class Delta with _$Delta { + const factory Delta({ + @JsonKey(name: 'Role') String? role, + @JsonKey(name: 'Content') String? content, + }) = _Delta; - Delta({this.role, this.content}); - - Delta.fromJson(Map json) { - role = json["Role"]; - content = json["Content"]; - } - - Map toJson() { - final Map data = {}; - data["Role"] = role; - data["Content"] = content; - return data; - } + factory Delta.fromJson(Map json) => _$DeltaFromJson(json); } diff --git a/lib/common/models/hunyuan.freezed.dart b/lib/common/models/hunyuan.freezed.dart new file mode 100644 index 0000000..ea8215b --- /dev/null +++ b/lib/common/models/hunyuan.freezed.dart @@ -0,0 +1,1250 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'hunyuan.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$PublicHeader { + + @JsonKey(name: 'X-TC-Action') String? get action; + + @JsonKey(name: 'X-TC-Timestamp') int? get timestamp; + + @JsonKey(name: 'X-TC-Version') String? get version; + + @JsonKey(name: 'Authorization') String? get authorization; + + /// Create a copy of PublicHeader + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PublicHeaderCopyWith get copyWith => + _$PublicHeaderCopyWithImpl( + this as PublicHeader, _$identity); + + /// Serializes this PublicHeader to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is PublicHeader && + (identical(other.action, action) || other.action == action) && + (identical(other.timestamp, timestamp) || + other.timestamp == timestamp) && + (identical(other.version, version) || other.version == version) && + (identical(other.authorization, authorization) || + other.authorization == authorization)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, action, timestamp, version, authorization); + + @override + String toString() { + return 'PublicHeader(action: $action, timestamp: $timestamp, version: $version, authorization: $authorization)'; + } + + +} + +/// @nodoc +abstract mixin class $PublicHeaderCopyWith<$Res> { + factory $PublicHeaderCopyWith(PublicHeader value, + $Res Function(PublicHeader) _then) = _$PublicHeaderCopyWithImpl; + + @useResult + $Res call({ + @JsonKey(name: 'X-TC-Action') String? action, @JsonKey( + name: 'X-TC-Timestamp') int? timestamp, @JsonKey( + name: 'X-TC-Version') String? version, @JsonKey( + name: 'Authorization') String? authorization + }); + + +} + +/// @nodoc +class _$PublicHeaderCopyWithImpl<$Res> + implements $PublicHeaderCopyWith<$Res> { + _$PublicHeaderCopyWithImpl(this._self, this._then); + + final PublicHeader _self; + final $Res Function(PublicHeader) _then; + + /// Create a copy of PublicHeader + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? action = freezed, Object? timestamp = freezed, Object? version = freezed, Object? authorization = freezed,}) { + return _then(_self.copyWith( + action: freezed == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String?, + timestamp: freezed == timestamp + ? _self.timestamp + : timestamp // ignore: cast_nullable_to_non_nullable + as int?, + version: freezed == version + ? _self.version + : version // ignore: cast_nullable_to_non_nullable + as String?, + authorization: freezed == authorization + ? _self.authorization + : authorization // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _PublicHeader implements PublicHeader { + const _PublicHeader({@JsonKey(name: 'X-TC-Action') this.action, @JsonKey( + name: 'X-TC-Timestamp') this.timestamp, @JsonKey( + name: 'X-TC-Version') this.version, @JsonKey( + name: 'Authorization') this.authorization}); + + factory _PublicHeader.fromJson(Map json) => + _$PublicHeaderFromJson(json); + + @override + @JsonKey(name: 'X-TC-Action') + final String? action; + @override + @JsonKey(name: 'X-TC-Timestamp') + final int? timestamp; + @override + @JsonKey(name: 'X-TC-Version') + final String? version; + @override + @JsonKey(name: 'Authorization') + final String? authorization; + + /// Create a copy of PublicHeader + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PublicHeaderCopyWith<_PublicHeader> get copyWith => + __$PublicHeaderCopyWithImpl<_PublicHeader>(this, _$identity); + + @override + Map toJson() { + return _$PublicHeaderToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _PublicHeader && + (identical(other.action, action) || other.action == action) && + (identical(other.timestamp, timestamp) || + other.timestamp == timestamp) && + (identical(other.version, version) || other.version == version) && + (identical(other.authorization, authorization) || + other.authorization == authorization)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, action, timestamp, version, authorization); + + @override + String toString() { + return 'PublicHeader(action: $action, timestamp: $timestamp, version: $version, authorization: $authorization)'; + } + + +} + +/// @nodoc +abstract mixin class _$PublicHeaderCopyWith<$Res> + implements $PublicHeaderCopyWith<$Res> { + factory _$PublicHeaderCopyWith(_PublicHeader value, + $Res Function(_PublicHeader) _then) = __$PublicHeaderCopyWithImpl; + + @override + @useResult + $Res call({ + @JsonKey(name: 'X-TC-Action') String? action, @JsonKey( + name: 'X-TC-Timestamp') int? timestamp, @JsonKey( + name: 'X-TC-Version') String? version, @JsonKey( + name: 'Authorization') String? authorization + }); + + +} + +/// @nodoc +class __$PublicHeaderCopyWithImpl<$Res> + implements _$PublicHeaderCopyWith<$Res> { + __$PublicHeaderCopyWithImpl(this._self, this._then); + + final _PublicHeader _self; + final $Res Function(_PublicHeader) _then; + + /// Create a copy of PublicHeader + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? action = freezed, Object? timestamp = freezed, Object? version = freezed, Object? authorization = freezed,}) { + return _then(_PublicHeader( + action: freezed == action + ? _self.action + : action // ignore: cast_nullable_to_non_nullable + as String?, + timestamp: freezed == timestamp + ? _self.timestamp + : timestamp // ignore: cast_nullable_to_non_nullable + as int?, + version: freezed == version + ? _self.version + : version // ignore: cast_nullable_to_non_nullable + as String?, + authorization: freezed == authorization + ? _self.authorization + : authorization // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + +} + + +/// @nodoc +mixin _$Message { + + @JsonKey(name: 'Role') String get role; + + @JsonKey(name: 'Content') String get content; + + /// Create a copy of Message + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageCopyWith get copyWith => + _$MessageCopyWithImpl(this as Message, _$identity); + + /// Serializes this Message to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Message && + (identical(other.role, role) || other.role == role) && + (identical(other.content, content) || other.content == content)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, role, content); + + @override + String toString() { + return 'Message(role: $role, content: $content)'; + } + + +} + +/// @nodoc +abstract mixin class $MessageCopyWith<$Res> { + factory $MessageCopyWith(Message value, + $Res Function(Message) _then) = _$MessageCopyWithImpl; + + @useResult + $Res call({ + @JsonKey(name: 'Role') String role, @JsonKey(name: 'Content') String content + }); + + +} + +/// @nodoc +class _$MessageCopyWithImpl<$Res> + implements $MessageCopyWith<$Res> { + _$MessageCopyWithImpl(this._self, this._then); + + final Message _self; + final $Res Function(Message) _then; + + /// Create a copy of Message + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? role = null, Object? content = null,}) { + return _then(_self.copyWith( + role: null == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String, + content: null == content + ? _self.content + : content // ignore: cast_nullable_to_non_nullable + as String, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Message implements Message { + const _Message({@JsonKey(name: 'Role') required this.role, @JsonKey( + name: 'Content') required this.content}); + + factory _Message.fromJson(Map json) => + _$MessageFromJson(json); + + @override + @JsonKey(name: 'Role') + final String role; + @override + @JsonKey(name: 'Content') + final String content; + + /// Create a copy of Message + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$MessageCopyWith<_Message> get copyWith => + __$MessageCopyWithImpl<_Message>(this, _$identity); + + @override + Map toJson() { + return _$MessageToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Message && + (identical(other.role, role) || other.role == role) && + (identical(other.content, content) || other.content == content)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, role, content); + + @override + String toString() { + return 'Message(role: $role, content: $content)'; + } + + +} + +/// @nodoc +abstract mixin class _$MessageCopyWith<$Res> implements $MessageCopyWith<$Res> { + factory _$MessageCopyWith(_Message value, + $Res Function(_Message) _then) = __$MessageCopyWithImpl; + + @override + @useResult + $Res call({ + @JsonKey(name: 'Role') String role, @JsonKey(name: 'Content') String content + }); + + +} + +/// @nodoc +class __$MessageCopyWithImpl<$Res> + implements _$MessageCopyWith<$Res> { + __$MessageCopyWithImpl(this._self, this._then); + + final _Message _self; + final $Res Function(_Message) _then; + + /// Create a copy of Message + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({Object? role = null, Object? content = null,}) { + return _then(_Message( + role: null == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String, + content: null == content + ? _self.content + : content // ignore: cast_nullable_to_non_nullable + as String, + )); + } + + +} + + +/// @nodoc +mixin _$HunyuanResponse { + + @JsonKey(name: 'Note') String? get note; + + @JsonKey(name: 'Choices') List? get choices; + + @JsonKey(name: 'Created') int? get created; + + @JsonKey(name: 'Id') String? get id; + + @JsonKey(name: 'Usage') Usage? get usage; + + /// Create a copy of HunyuanResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $HunyuanResponseCopyWith get copyWith => + _$HunyuanResponseCopyWithImpl( + this as HunyuanResponse, _$identity); + + /// Serializes this HunyuanResponse to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is HunyuanResponse && + (identical(other.note, note) || other.note == note) && + const DeepCollectionEquality().equals(other.choices, choices) && + (identical(other.created, created) || other.created == created) && + (identical(other.id, id) || other.id == id) && + (identical(other.usage, usage) || other.usage == usage)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, note, const DeepCollectionEquality().hash(choices), + created, + id, usage); + + @override + String toString() { + return 'HunyuanResponse(note: $note, choices: $choices, created: $created, id: $id, usage: $usage)'; + } + + +} + +/// @nodoc +abstract mixin class $HunyuanResponseCopyWith<$Res> { + factory $HunyuanResponseCopyWith(HunyuanResponse value, + $Res Function(HunyuanResponse) _then) = _$HunyuanResponseCopyWithImpl; + + @useResult + $Res call({ + @JsonKey(name: 'Note') String? note, @JsonKey(name: 'Choices') List< + Choices>? choices, @JsonKey(name: 'Created') int? created, @JsonKey( + name: 'Id') String? id, @JsonKey(name: 'Usage') Usage? usage + }); + + + $UsageCopyWith<$Res>? get usage; + +} + +/// @nodoc +class _$HunyuanResponseCopyWithImpl<$Res> + implements $HunyuanResponseCopyWith<$Res> { + _$HunyuanResponseCopyWithImpl(this._self, this._then); + + final HunyuanResponse _self; + final $Res Function(HunyuanResponse) _then; + + /// Create a copy of HunyuanResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? note = freezed, Object? choices = freezed, Object? created = freezed, Object? id = freezed, Object? usage = freezed,}) { + return _then(_self.copyWith( + note: freezed == note + ? _self.note + : note // ignore: cast_nullable_to_non_nullable + as String?, + choices: freezed == choices + ? _self.choices + : choices // ignore: cast_nullable_to_non_nullable + as List?, + created: freezed == created + ? _self.created + : created // ignore: cast_nullable_to_non_nullable + as int?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as String?, + usage: freezed == usage + ? _self.usage + : usage // ignore: cast_nullable_to_non_nullable + as Usage?, + )); + } + + /// Create a copy of HunyuanResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UsageCopyWith<$Res>? get usage { + if (_self.usage == null) { + return null; + } + + return $UsageCopyWith<$Res>(_self.usage!, (value) { + return _then(_self.copyWith(usage: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _HunyuanResponse implements HunyuanResponse { + const _HunyuanResponse( + {@JsonKey(name: 'Note') this.note, @JsonKey(name: 'Choices') final List< + Choices>? choices, @JsonKey(name: 'Created') this.created, @JsonKey( + name: 'Id') this.id, @JsonKey(name: 'Usage') this.usage}) + : _choices = choices; + + factory _HunyuanResponse.fromJson(Map json) => + _$HunyuanResponseFromJson(json); + + @override + @JsonKey(name: 'Note') + final String? note; + final List? _choices; + + @override + @JsonKey(name: 'Choices') + List? get choices { + final value = _choices; + if (value == null) return null; + if (_choices is EqualUnmodifiableListView) return _choices; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + @JsonKey(name: 'Created') + final int? created; + @override + @JsonKey(name: 'Id') + final String? id; + @override + @JsonKey(name: 'Usage') + final Usage? usage; + + /// Create a copy of HunyuanResponse + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$HunyuanResponseCopyWith<_HunyuanResponse> get copyWith => + __$HunyuanResponseCopyWithImpl<_HunyuanResponse>(this, _$identity); + + @override + Map toJson() { + return _$HunyuanResponseToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _HunyuanResponse && + (identical(other.note, note) || other.note == note) && + const DeepCollectionEquality().equals(other._choices, _choices) && + (identical(other.created, created) || other.created == created) && + (identical(other.id, id) || other.id == id) && + (identical(other.usage, usage) || other.usage == usage)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, note, const DeepCollectionEquality().hash(_choices), + created, + id, usage); + + @override + String toString() { + return 'HunyuanResponse(note: $note, choices: $choices, created: $created, id: $id, usage: $usage)'; + } + + +} + +/// @nodoc +abstract mixin class _$HunyuanResponseCopyWith<$Res> + implements $HunyuanResponseCopyWith<$Res> { + factory _$HunyuanResponseCopyWith(_HunyuanResponse value, + $Res Function(_HunyuanResponse) _then) = __$HunyuanResponseCopyWithImpl; + + @override + @useResult + $Res call({ + @JsonKey(name: 'Note') String? note, @JsonKey(name: 'Choices') List< + Choices>? choices, @JsonKey(name: 'Created') int? created, @JsonKey( + name: 'Id') String? id, @JsonKey(name: 'Usage') Usage? usage + }); + + + @override $UsageCopyWith<$Res>? get usage; + +} + +/// @nodoc +class __$HunyuanResponseCopyWithImpl<$Res> + implements _$HunyuanResponseCopyWith<$Res> { + __$HunyuanResponseCopyWithImpl(this._self, this._then); + + final _HunyuanResponse _self; + final $Res Function(_HunyuanResponse) _then; + + /// Create a copy of HunyuanResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? note = freezed, Object? choices = freezed, Object? created = freezed, Object? id = freezed, Object? usage = freezed,}) { + return _then(_HunyuanResponse( + note: freezed == note + ? _self.note + : note // ignore: cast_nullable_to_non_nullable + as String?, + choices: freezed == choices + ? _self._choices + : choices // ignore: cast_nullable_to_non_nullable + as List?, + created: freezed == created + ? _self.created + : created // ignore: cast_nullable_to_non_nullable + as int?, + id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable + as String?, + usage: freezed == usage + ? _self.usage + : usage // ignore: cast_nullable_to_non_nullable + as Usage?, + )); + } + + /// Create a copy of HunyuanResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UsageCopyWith<$Res>? get usage { + if (_self.usage == null) { + return null; + } + + return $UsageCopyWith<$Res>(_self.usage!, (value) { + return _then(_self.copyWith(usage: value)); + }); + } +} + + +/// @nodoc +mixin _$Usage { + + @JsonKey(name: 'PromptTokens') int? get promptTokens; + + @JsonKey(name: 'CompletionTokens') int? get completionTokens; + + @JsonKey(name: 'TotalTokens') int? get totalTokens; + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UsageCopyWith get copyWith => + _$UsageCopyWithImpl(this as Usage, _$identity); + + /// Serializes this Usage to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Usage && + (identical(other.promptTokens, promptTokens) || + other.promptTokens == promptTokens) && + (identical(other.completionTokens, completionTokens) || + other.completionTokens == completionTokens) && + (identical(other.totalTokens, totalTokens) || + other.totalTokens == totalTokens)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, promptTokens, completionTokens, totalTokens); + + @override + String toString() { + return 'Usage(promptTokens: $promptTokens, completionTokens: $completionTokens, totalTokens: $totalTokens)'; + } + + +} + +/// @nodoc +abstract mixin class $UsageCopyWith<$Res> { + factory $UsageCopyWith(Usage value, + $Res Function(Usage) _then) = _$UsageCopyWithImpl; + + @useResult + $Res call({ + @JsonKey(name: 'PromptTokens') int? promptTokens, @JsonKey( + name: 'CompletionTokens') int? completionTokens, @JsonKey( + name: 'TotalTokens') int? totalTokens + }); + + +} + +/// @nodoc +class _$UsageCopyWithImpl<$Res> + implements $UsageCopyWith<$Res> { + _$UsageCopyWithImpl(this._self, this._then); + + final Usage _self; + final $Res Function(Usage) _then; + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? promptTokens = freezed, Object? completionTokens = freezed, Object? totalTokens = freezed,}) { + return _then(_self.copyWith( + promptTokens: freezed == promptTokens + ? _self.promptTokens + : promptTokens // ignore: cast_nullable_to_non_nullable + as int?, + completionTokens: freezed == completionTokens + ? _self.completionTokens + : completionTokens // ignore: cast_nullable_to_non_nullable + as int?, + totalTokens: freezed == totalTokens + ? _self.totalTokens + : totalTokens // ignore: cast_nullable_to_non_nullable + as int?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Usage implements Usage { + const _Usage({@JsonKey(name: 'PromptTokens') this.promptTokens, @JsonKey( + name: 'CompletionTokens') this.completionTokens, @JsonKey( + name: 'TotalTokens') this.totalTokens}); + + factory _Usage.fromJson(Map json) => _$UsageFromJson(json); + + @override + @JsonKey(name: 'PromptTokens') + final int? promptTokens; + @override + @JsonKey(name: 'CompletionTokens') + final int? completionTokens; + @override + @JsonKey(name: 'TotalTokens') + final int? totalTokens; + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$UsageCopyWith<_Usage> get copyWith => + __$UsageCopyWithImpl<_Usage>(this, _$identity); + + @override + Map toJson() { + return _$UsageToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Usage && + (identical(other.promptTokens, promptTokens) || + other.promptTokens == promptTokens) && + (identical(other.completionTokens, completionTokens) || + other.completionTokens == completionTokens) && + (identical(other.totalTokens, totalTokens) || + other.totalTokens == totalTokens)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, promptTokens, completionTokens, totalTokens); + + @override + String toString() { + return 'Usage(promptTokens: $promptTokens, completionTokens: $completionTokens, totalTokens: $totalTokens)'; + } + + +} + +/// @nodoc +abstract mixin class _$UsageCopyWith<$Res> implements $UsageCopyWith<$Res> { + factory _$UsageCopyWith(_Usage value, + $Res Function(_Usage) _then) = __$UsageCopyWithImpl; + + @override + @useResult + $Res call({ + @JsonKey(name: 'PromptTokens') int? promptTokens, @JsonKey( + name: 'CompletionTokens') int? completionTokens, @JsonKey( + name: 'TotalTokens') int? totalTokens + }); + + +} + +/// @nodoc +class __$UsageCopyWithImpl<$Res> + implements _$UsageCopyWith<$Res> { + __$UsageCopyWithImpl(this._self, this._then); + + final _Usage _self; + final $Res Function(_Usage) _then; + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? promptTokens = freezed, Object? completionTokens = freezed, Object? totalTokens = freezed,}) { + return _then(_Usage( + promptTokens: freezed == promptTokens + ? _self.promptTokens + : promptTokens // ignore: cast_nullable_to_non_nullable + as int?, + completionTokens: freezed == completionTokens + ? _self.completionTokens + : completionTokens // ignore: cast_nullable_to_non_nullable + as int?, + totalTokens: freezed == totalTokens + ? _self.totalTokens + : totalTokens // ignore: cast_nullable_to_non_nullable + as int?, + )); + } + + +} + + +/// @nodoc +mixin _$Choices { + + @JsonKey(name: 'FinishReason') String? get finishReason; + + @JsonKey(name: 'Delta') Delta? get delta; + + /// Create a copy of Choices + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ChoicesCopyWith get copyWith => + _$ChoicesCopyWithImpl(this as Choices, _$identity); + + /// Serializes this Choices to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Choices && + (identical(other.finishReason, finishReason) || + other.finishReason == finishReason) && + (identical(other.delta, delta) || other.delta == delta)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, finishReason, delta); + + @override + String toString() { + return 'Choices(finishReason: $finishReason, delta: $delta)'; + } + + +} + +/// @nodoc +abstract mixin class $ChoicesCopyWith<$Res> { + factory $ChoicesCopyWith(Choices value, + $Res Function(Choices) _then) = _$ChoicesCopyWithImpl; + + @useResult + $Res call({ + @JsonKey(name: 'FinishReason') String? finishReason, @JsonKey( + name: 'Delta') Delta? delta + }); + + + $DeltaCopyWith<$Res>? get delta; + +} + +/// @nodoc +class _$ChoicesCopyWithImpl<$Res> + implements $ChoicesCopyWith<$Res> { + _$ChoicesCopyWithImpl(this._self, this._then); + + final Choices _self; + final $Res Function(Choices) _then; + + /// Create a copy of Choices + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? finishReason = freezed, Object? delta = freezed,}) { + return _then(_self.copyWith( + finishReason: freezed == finishReason + ? _self.finishReason + : finishReason // ignore: cast_nullable_to_non_nullable + as String?, + delta: freezed == delta + ? _self.delta + : delta // ignore: cast_nullable_to_non_nullable + as Delta?, + )); + } + + /// Create a copy of Choices + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $DeltaCopyWith<$Res>? get delta { + if (_self.delta == null) { + return null; + } + + return $DeltaCopyWith<$Res>(_self.delta!, (value) { + return _then(_self.copyWith(delta: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _Choices implements Choices { + const _Choices({@JsonKey(name: 'FinishReason') this.finishReason, @JsonKey( + name: 'Delta') this.delta}); + + factory _Choices.fromJson(Map json) => + _$ChoicesFromJson(json); + + @override + @JsonKey(name: 'FinishReason') + final String? finishReason; + @override + @JsonKey(name: 'Delta') + final Delta? delta; + + /// Create a copy of Choices + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ChoicesCopyWith<_Choices> get copyWith => + __$ChoicesCopyWithImpl<_Choices>(this, _$identity); + + @override + Map toJson() { + return _$ChoicesToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Choices && + (identical(other.finishReason, finishReason) || + other.finishReason == finishReason) && + (identical(other.delta, delta) || other.delta == delta)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, finishReason, delta); + + @override + String toString() { + return 'Choices(finishReason: $finishReason, delta: $delta)'; + } + + +} + +/// @nodoc +abstract mixin class _$ChoicesCopyWith<$Res> implements $ChoicesCopyWith<$Res> { + factory _$ChoicesCopyWith(_Choices value, + $Res Function(_Choices) _then) = __$ChoicesCopyWithImpl; + + @override + @useResult + $Res call({ + @JsonKey(name: 'FinishReason') String? finishReason, @JsonKey( + name: 'Delta') Delta? delta + }); + + + @override $DeltaCopyWith<$Res>? get delta; + +} + +/// @nodoc +class __$ChoicesCopyWithImpl<$Res> + implements _$ChoicesCopyWith<$Res> { + __$ChoicesCopyWithImpl(this._self, this._then); + + final _Choices _self; + final $Res Function(_Choices) _then; + + /// Create a copy of Choices + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({Object? finishReason = freezed, Object? delta = freezed,}) { + return _then(_Choices( + finishReason: freezed == finishReason + ? _self.finishReason + : finishReason // ignore: cast_nullable_to_non_nullable + as String?, + delta: freezed == delta + ? _self.delta + : delta // ignore: cast_nullable_to_non_nullable + as Delta?, + )); + } + + /// Create a copy of Choices + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $DeltaCopyWith<$Res>? get delta { + if (_self.delta == null) { + return null; + } + + return $DeltaCopyWith<$Res>(_self.delta!, (value) { + return _then(_self.copyWith(delta: value)); + }); + } +} + + +/// @nodoc +mixin _$Delta { + + @JsonKey(name: 'Role') String? get role; + + @JsonKey(name: 'Content') String? get content; + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeltaCopyWith get copyWith => + _$DeltaCopyWithImpl(this as Delta, _$identity); + + /// Serializes this Delta to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Delta && + (identical(other.role, role) || other.role == role) && + (identical(other.content, content) || other.content == content)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, role, content); + + @override + String toString() { + return 'Delta(role: $role, content: $content)'; + } + + +} + +/// @nodoc +abstract mixin class $DeltaCopyWith<$Res> { + factory $DeltaCopyWith(Delta value, + $Res Function(Delta) _then) = _$DeltaCopyWithImpl; + + @useResult + $Res call({ + @JsonKey(name: 'Role') String? role, @JsonKey( + name: 'Content') String? content + }); + + +} + +/// @nodoc +class _$DeltaCopyWithImpl<$Res> + implements $DeltaCopyWith<$Res> { + _$DeltaCopyWithImpl(this._self, this._then); + + final Delta _self; + final $Res Function(Delta) _then; + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? role = freezed, Object? content = freezed,}) { + return _then(_self.copyWith( + role: freezed == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String?, + content: freezed == content + ? _self.content + : content // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Delta implements Delta { + const _Delta({@JsonKey(name: 'Role') this.role, @JsonKey( + name: 'Content') this.content}); + + factory _Delta.fromJson(Map json) => _$DeltaFromJson(json); + + @override + @JsonKey(name: 'Role') + final String? role; + @override + @JsonKey(name: 'Content') + final String? content; + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$DeltaCopyWith<_Delta> get copyWith => + __$DeltaCopyWithImpl<_Delta>(this, _$identity); + + @override + Map toJson() { + return _$DeltaToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Delta && + (identical(other.role, role) || other.role == role) && + (identical(other.content, content) || other.content == content)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, role, content); + + @override + String toString() { + return 'Delta(role: $role, content: $content)'; + } + + +} + +/// @nodoc +abstract mixin class _$DeltaCopyWith<$Res> implements $DeltaCopyWith<$Res> { + factory _$DeltaCopyWith(_Delta value, + $Res Function(_Delta) _then) = __$DeltaCopyWithImpl; + + @override + @useResult + $Res call({ + @JsonKey(name: 'Role') String? role, @JsonKey( + name: 'Content') String? content + }); + + +} + +/// @nodoc +class __$DeltaCopyWithImpl<$Res> + implements _$DeltaCopyWith<$Res> { + __$DeltaCopyWithImpl(this._self, this._then); + + final _Delta _self; + final $Res Function(_Delta) _then; + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({Object? role = freezed, Object? content = freezed,}) { + return _then(_Delta( + role: freezed == role + ? _self.role + : role // ignore: cast_nullable_to_non_nullable + as String?, + content: freezed == content + ? _self.content + : content // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + +} + +// dart format on diff --git a/lib/common/models/hunyuan.g.dart b/lib/common/models/hunyuan.g.dart new file mode 100644 index 0000000..82036ef --- /dev/null +++ b/lib/common/models/hunyuan.g.dart @@ -0,0 +1,88 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'hunyuan.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_PublicHeader _$PublicHeaderFromJson(Map json) => + _PublicHeader( + action: json['X-TC-Action'] as String?, + timestamp: (json['X-TC-Timestamp'] as num?)?.toInt(), + version: json['X-TC-Version'] as String?, + authorization: json['Authorization'] as String?, + ); + +Map _$PublicHeaderToJson(_PublicHeader instance) => + { + if (instance.action case final value?) 'X-TC-Action': value, + if (instance.timestamp case final value?) 'X-TC-Timestamp': value, + if (instance.version case final value?) 'X-TC-Version': value, + if (instance.authorization case final value?) 'Authorization': value, + }; + +_Message _$MessageFromJson(Map json) => + _Message(role: json['Role'] as String, content: json['Content'] as String); + +Map _$MessageToJson(_Message instance) => { + 'Role': instance.role, + 'Content': instance.content, +}; + +_HunyuanResponse _$HunyuanResponseFromJson(Map json) => + _HunyuanResponse( + note: json['Note'] as String?, + choices: + (json['Choices'] as List?) + ?.map((e) => Choices.fromJson(e as Map)) + .toList(), + created: (json['Created'] as num?)?.toInt(), + id: json['Id'] as String?, + usage: + json['Usage'] == null + ? null + : Usage.fromJson(json['Usage'] as Map), + ); + +Map _$HunyuanResponseToJson(_HunyuanResponse instance) => + { + if (instance.note case final value?) 'Note': value, + if (instance.choices case final value?) 'Choices': value, + if (instance.created case final value?) 'Created': value, + if (instance.id case final value?) 'Id': value, + if (instance.usage case final value?) 'Usage': value, + }; + +_Usage _$UsageFromJson(Map json) => _Usage( + promptTokens: (json['PromptTokens'] as num?)?.toInt(), + completionTokens: (json['CompletionTokens'] as num?)?.toInt(), + totalTokens: (json['TotalTokens'] as num?)?.toInt(), +); + +Map _$UsageToJson(_Usage instance) => { + if (instance.promptTokens case final value?) 'PromptTokens': value, + if (instance.completionTokens case final value?) 'CompletionTokens': value, + if (instance.totalTokens case final value?) 'TotalTokens': value, +}; + +_Choices _$ChoicesFromJson(Map json) => _Choices( + finishReason: json['FinishReason'] as String?, + delta: + json['Delta'] == null + ? null + : Delta.fromJson(json['Delta'] as Map), +); + +Map _$ChoicesToJson(_Choices instance) => { + if (instance.finishReason case final value?) 'FinishReason': value, + if (instance.delta case final value?) 'Delta': value, +}; + +_Delta _$DeltaFromJson(Map json) => + _Delta(role: json['Role'] as String?, content: json['Content'] as String?); + +Map _$DeltaToJson(_Delta instance) => { + if (instance.role case final value?) 'Role': value, + if (instance.content case final value?) 'Content': value, +}; diff --git a/lib/common/models/image.dart b/lib/common/models/image.dart index f9e0b44..5cd4ecf 100644 --- a/lib/common/models/image.dart +++ b/lib/common/models/image.dart @@ -1,130 +1,50 @@ -class BingImage { - List? images; - Tooltips? tooltips; +import 'package:freezed_annotation/freezed_annotation.dart'; - BingImage({this.images, this.tooltips}); +part 'image.freezed.dart'; +part 'image.g.dart'; - BingImage.fromJson(Map json) { - images = - json["images"] == null - ? null - : (json["images"] as List).map((e) => Images.fromJson(e)).toList(); - tooltips = - json["tooltips"] == null ? null : Tooltips.fromJson(json["tooltips"]); - } +@freezed +abstract class BingImage with _$BingImage { + const factory BingImage({List? images, Tooltips? tooltips}) = + _BingImage; - Map toJson() { - final Map data = {}; - if (images != null) { - data["images"] = images?.map((e) => e.toJson()).toList(); - } - if (tooltips != null) { - data["tooltips"] = tooltips?.toJson(); - } - return data; - } + factory BingImage.fromJson(Map json) => + _$BingImageFromJson(json); } -class Tooltips { - String? loading; - String? previous; - String? next; - String? walle; - String? walls; +@freezed +abstract class Tooltips with _$Tooltips { + const factory Tooltips({ + String? loading, + String? previous, + String? next, + String? walle, + String? walls, + }) = _Tooltips; - Tooltips({this.loading, this.previous, this.next, this.walle, this.walls}); - - Tooltips.fromJson(Map json) { - loading = json["loading"]; - previous = json["previous"]; - next = json["next"]; - walle = json["walle"]; - walls = json["walls"]; - } - - Map toJson() { - final Map data = {}; - data["loading"] = loading; - data["previous"] = previous; - data["next"] = next; - data["walle"] = walle; - data["walls"] = walls; - return data; - } + factory Tooltips.fromJson(Map json) => + _$TooltipsFromJson(json); } -class Images { - String? startdate; - String? fullstartdate; - String? enddate; - String? url; - String? urlbase; - String? copyright; - String? copyrightlink; - String? title; - String? quiz; - bool? wp; - String? hsh; - int? drk; - int? top; - int? bot; - List? hs; +@freezed +abstract class Images with _$Images { + const factory Images({ + String? startdate, + String? fullstartdate, + String? enddate, + String? url, + String? urlbase, + String? copyright, + String? copyrightlink, + String? title, + String? quiz, + bool? wp, + String? hsh, + int? drk, + int? top, + int? bot, + List? hs, + }) = _Images; - Images({ - this.startdate, - this.fullstartdate, - this.enddate, - this.url, - this.urlbase, - this.copyright, - this.copyrightlink, - this.title, - this.quiz, - this.wp, - this.hsh, - this.drk, - this.top, - this.bot, - this.hs, - }); - - Images.fromJson(Map json) { - startdate = json["startdate"]; - fullstartdate = json["fullstartdate"]; - enddate = json["enddate"]; - url = json["url"]; - urlbase = json["urlbase"]; - copyright = json["copyright"]; - copyrightlink = json["copyrightlink"]; - title = json["title"]; - quiz = json["quiz"]; - wp = json["wp"]; - hsh = json["hsh"]; - drk = json["drk"]; - top = json["top"]; - bot = json["bot"]; - hs = json["hs"] ?? []; - } - - Map toJson() { - final Map data = {}; - data["startdate"] = startdate; - data["fullstartdate"] = fullstartdate; - data["enddate"] = enddate; - data["url"] = url; - data["urlbase"] = urlbase; - data["copyright"] = copyright; - data["copyrightlink"] = copyrightlink; - data["title"] = title; - data["quiz"] = quiz; - data["wp"] = wp; - data["hsh"] = hsh; - data["drk"] = drk; - data["top"] = top; - data["bot"] = bot; - if (hs != null) { - data["hs"] = hs; - } - return data; - } + factory Images.fromJson(Map json) => _$ImagesFromJson(json); } diff --git a/lib/common/models/image.freezed.dart b/lib/common/models/image.freezed.dart new file mode 100644 index 0000000..cd5f539 --- /dev/null +++ b/lib/common/models/image.freezed.dart @@ -0,0 +1,825 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'image.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$BingImage { + + List? get images; + + Tooltips? get tooltips; + + /// Create a copy of BingImage + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $BingImageCopyWith get copyWith => + _$BingImageCopyWithImpl(this as BingImage, _$identity); + + /// Serializes this BingImage to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is BingImage && + const DeepCollectionEquality().equals(other.images, images) && + (identical(other.tooltips, tooltips) || + other.tooltips == tooltips)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, const DeepCollectionEquality().hash(images), tooltips); + + @override + String toString() { + return 'BingImage(images: $images, tooltips: $tooltips)'; + } + + +} + +/// @nodoc +abstract mixin class $BingImageCopyWith<$Res> { + factory $BingImageCopyWith(BingImage value, + $Res Function(BingImage) _then) = _$BingImageCopyWithImpl; + + @useResult + $Res call({ + List? images, Tooltips? tooltips + }); + + + $TooltipsCopyWith<$Res>? get tooltips; + +} + +/// @nodoc +class _$BingImageCopyWithImpl<$Res> + implements $BingImageCopyWith<$Res> { + _$BingImageCopyWithImpl(this._self, this._then); + + final BingImage _self; + final $Res Function(BingImage) _then; + + /// Create a copy of BingImage + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? images = freezed, Object? tooltips = freezed,}) { + return _then(_self.copyWith( + images: freezed == images + ? _self.images + : images // ignore: cast_nullable_to_non_nullable + as List?, + tooltips: freezed == tooltips + ? _self.tooltips + : tooltips // ignore: cast_nullable_to_non_nullable + as Tooltips?, + )); + } + + /// Create a copy of BingImage + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $TooltipsCopyWith<$Res>? get tooltips { + if (_self.tooltips == null) { + return null; + } + + return $TooltipsCopyWith<$Res>(_self.tooltips!, (value) { + return _then(_self.copyWith(tooltips: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _BingImage implements BingImage { + const _BingImage({final List? images, this.tooltips}) + : _images = images; + + factory _BingImage.fromJson(Map json) => + _$BingImageFromJson(json); + + final List? _images; + + @override List? get images { + final value = _images; + if (value == null) return null; + if (_images is EqualUnmodifiableListView) return _images; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override final Tooltips? tooltips; + + /// Create a copy of BingImage + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$BingImageCopyWith<_BingImage> get copyWith => + __$BingImageCopyWithImpl<_BingImage>(this, _$identity); + + @override + Map toJson() { + return _$BingImageToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _BingImage && + const DeepCollectionEquality().equals(other._images, _images) && + (identical(other.tooltips, tooltips) || + other.tooltips == tooltips)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, const DeepCollectionEquality().hash(_images), tooltips); + + @override + String toString() { + return 'BingImage(images: $images, tooltips: $tooltips)'; + } + + +} + +/// @nodoc +abstract mixin class _$BingImageCopyWith<$Res> + implements $BingImageCopyWith<$Res> { + factory _$BingImageCopyWith(_BingImage value, + $Res Function(_BingImage) _then) = __$BingImageCopyWithImpl; + + @override + @useResult + $Res call({ + List? images, Tooltips? tooltips + }); + + + @override $TooltipsCopyWith<$Res>? get tooltips; + +} + +/// @nodoc +class __$BingImageCopyWithImpl<$Res> + implements _$BingImageCopyWith<$Res> { + __$BingImageCopyWithImpl(this._self, this._then); + + final _BingImage _self; + final $Res Function(_BingImage) _then; + + /// Create a copy of BingImage + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({Object? images = freezed, Object? tooltips = freezed,}) { + return _then(_BingImage( + images: freezed == images + ? _self._images + : images // ignore: cast_nullable_to_non_nullable + as List?, + tooltips: freezed == tooltips + ? _self.tooltips + : tooltips // ignore: cast_nullable_to_non_nullable + as Tooltips?, + )); + } + + /// Create a copy of BingImage + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $TooltipsCopyWith<$Res>? get tooltips { + if (_self.tooltips == null) { + return null; + } + + return $TooltipsCopyWith<$Res>(_self.tooltips!, (value) { + return _then(_self.copyWith(tooltips: value)); + }); + } +} + + +/// @nodoc +mixin _$Tooltips { + + String? get loading; + + String? get previous; + + String? get next; + + String? get walle; + + String? get walls; + + /// Create a copy of Tooltips + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $TooltipsCopyWith get copyWith => + _$TooltipsCopyWithImpl(this as Tooltips, _$identity); + + /// Serializes this Tooltips to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Tooltips && + (identical(other.loading, loading) || other.loading == loading) && + (identical(other.previous, previous) || + other.previous == previous) && + (identical(other.next, next) || other.next == next) && + (identical(other.walle, walle) || other.walle == walle) && + (identical(other.walls, walls) || other.walls == walls)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, loading, previous, next, walle, walls); + + @override + String toString() { + return 'Tooltips(loading: $loading, previous: $previous, next: $next, walle: $walle, walls: $walls)'; + } + + +} + +/// @nodoc +abstract mixin class $TooltipsCopyWith<$Res> { + factory $TooltipsCopyWith(Tooltips value, + $Res Function(Tooltips) _then) = _$TooltipsCopyWithImpl; + + @useResult + $Res call({ + String? loading, String? previous, String? next, String? walle, String? walls + }); + + +} + +/// @nodoc +class _$TooltipsCopyWithImpl<$Res> + implements $TooltipsCopyWith<$Res> { + _$TooltipsCopyWithImpl(this._self, this._then); + + final Tooltips _self; + final $Res Function(Tooltips) _then; + + /// Create a copy of Tooltips + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? loading = freezed, Object? previous = freezed, Object? next = freezed, Object? walle = freezed, Object? walls = freezed,}) { + return _then(_self.copyWith( + loading: freezed == loading + ? _self.loading + : loading // ignore: cast_nullable_to_non_nullable + as String?, + previous: freezed == previous + ? _self.previous + : previous // ignore: cast_nullable_to_non_nullable + as String?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + walle: freezed == walle + ? _self.walle + : walle // ignore: cast_nullable_to_non_nullable + as String?, + walls: freezed == walls + ? _self.walls + : walls // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Tooltips implements Tooltips { + const _Tooltips( + {this.loading, this.previous, this.next, this.walle, this.walls}); + + factory _Tooltips.fromJson(Map json) => + _$TooltipsFromJson(json); + + @override final String? loading; + @override final String? previous; + @override final String? next; + @override final String? walle; + @override final String? walls; + + /// Create a copy of Tooltips + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$TooltipsCopyWith<_Tooltips> get copyWith => + __$TooltipsCopyWithImpl<_Tooltips>(this, _$identity); + + @override + Map toJson() { + return _$TooltipsToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Tooltips && + (identical(other.loading, loading) || other.loading == loading) && + (identical(other.previous, previous) || + other.previous == previous) && + (identical(other.next, next) || other.next == next) && + (identical(other.walle, walle) || other.walle == walle) && + (identical(other.walls, walls) || other.walls == walls)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, loading, previous, next, walle, walls); + + @override + String toString() { + return 'Tooltips(loading: $loading, previous: $previous, next: $next, walle: $walle, walls: $walls)'; + } + + +} + +/// @nodoc +abstract mixin class _$TooltipsCopyWith<$Res> + implements $TooltipsCopyWith<$Res> { + factory _$TooltipsCopyWith(_Tooltips value, + $Res Function(_Tooltips) _then) = __$TooltipsCopyWithImpl; + + @override + @useResult + $Res call({ + String? loading, String? previous, String? next, String? walle, String? walls + }); + + +} + +/// @nodoc +class __$TooltipsCopyWithImpl<$Res> + implements _$TooltipsCopyWith<$Res> { + __$TooltipsCopyWithImpl(this._self, this._then); + + final _Tooltips _self; + final $Res Function(_Tooltips) _then; + + /// Create a copy of Tooltips + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? loading = freezed, Object? previous = freezed, Object? next = freezed, Object? walle = freezed, Object? walls = freezed,}) { + return _then(_Tooltips( + loading: freezed == loading + ? _self.loading + : loading // ignore: cast_nullable_to_non_nullable + as String?, + previous: freezed == previous + ? _self.previous + : previous // ignore: cast_nullable_to_non_nullable + as String?, + next: freezed == next + ? _self.next + : next // ignore: cast_nullable_to_non_nullable + as String?, + walle: freezed == walle + ? _self.walle + : walle // ignore: cast_nullable_to_non_nullable + as String?, + walls: freezed == walls + ? _self.walls + : walls // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + +} + + +/// @nodoc +mixin _$Images { + + String? get startdate; + + String? get fullstartdate; + + String? get enddate; + + String? get url; + + String? get urlbase; + + String? get copyright; + + String? get copyrightlink; + + String? get title; + + String? get quiz; + + bool? get wp; + + String? get hsh; + + int? get drk; + + int? get top; + + int? get bot; + + List? get hs; + + /// Create a copy of Images + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ImagesCopyWith get copyWith => + _$ImagesCopyWithImpl(this as Images, _$identity); + + /// Serializes this Images to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Images && + (identical(other.startdate, startdate) || + other.startdate == startdate) && + (identical(other.fullstartdate, fullstartdate) || + other.fullstartdate == fullstartdate) && + (identical(other.enddate, enddate) || other.enddate == enddate) && + (identical(other.url, url) || other.url == url) && + (identical(other.urlbase, urlbase) || other.urlbase == urlbase) && + (identical(other.copyright, copyright) || + other.copyright == copyright) && + (identical(other.copyrightlink, copyrightlink) || + other.copyrightlink == copyrightlink) && + (identical(other.title, title) || other.title == title) && + (identical(other.quiz, quiz) || other.quiz == quiz) && + (identical(other.wp, wp) || other.wp == wp) && + (identical(other.hsh, hsh) || other.hsh == hsh) && + (identical(other.drk, drk) || other.drk == drk) && + (identical(other.top, top) || other.top == top) && + (identical(other.bot, bot) || other.bot == bot) && + const DeepCollectionEquality().equals(other.hs, hs)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + startdate, + fullstartdate, + enddate, + url, + urlbase, + copyright, + copyrightlink, + title, + quiz, + wp, + hsh, + drk, + top, + bot, + const DeepCollectionEquality().hash(hs)); + + @override + String toString() { + return 'Images(startdate: $startdate, fullstartdate: $fullstartdate, enddate: $enddate, url: $url, urlbase: $urlbase, copyright: $copyright, copyrightlink: $copyrightlink, title: $title, quiz: $quiz, wp: $wp, hsh: $hsh, drk: $drk, top: $top, bot: $bot, hs: $hs)'; + } + + +} + +/// @nodoc +abstract mixin class $ImagesCopyWith<$Res> { + factory $ImagesCopyWith(Images value, + $Res Function(Images) _then) = _$ImagesCopyWithImpl; + + @useResult + $Res call({ + String? startdate, String? fullstartdate, String? enddate, String? url, String? urlbase, String? copyright, String? copyrightlink, String? title, String? quiz, bool? wp, String? hsh, int? drk, int? top, int? bot, List< + dynamic>? hs + }); + + +} + +/// @nodoc +class _$ImagesCopyWithImpl<$Res> + implements $ImagesCopyWith<$Res> { + _$ImagesCopyWithImpl(this._self, this._then); + + final Images _self; + final $Res Function(Images) _then; + + /// Create a copy of Images + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? startdate = freezed, Object? fullstartdate = freezed, Object? enddate = freezed, Object? url = freezed, Object? urlbase = freezed, Object? copyright = freezed, Object? copyrightlink = freezed, Object? title = freezed, Object? quiz = freezed, Object? wp = freezed, Object? hsh = freezed, Object? drk = freezed, Object? top = freezed, Object? bot = freezed, Object? hs = freezed,}) { + return _then(_self.copyWith( + startdate: freezed == startdate + ? _self.startdate + : startdate // ignore: cast_nullable_to_non_nullable + as String?, + fullstartdate: freezed == fullstartdate + ? _self.fullstartdate + : fullstartdate // ignore: cast_nullable_to_non_nullable + as String?, + enddate: freezed == enddate + ? _self.enddate + : enddate // ignore: cast_nullable_to_non_nullable + as String?, + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + urlbase: freezed == urlbase + ? _self.urlbase + : urlbase // ignore: cast_nullable_to_non_nullable + as String?, + copyright: freezed == copyright + ? _self.copyright + : copyright // ignore: cast_nullable_to_non_nullable + as String?, + copyrightlink: freezed == copyrightlink + ? _self.copyrightlink + : copyrightlink // ignore: cast_nullable_to_non_nullable + as String?, + title: freezed == title + ? _self.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + quiz: freezed == quiz + ? _self.quiz + : quiz // ignore: cast_nullable_to_non_nullable + as String?, + wp: freezed == wp ? _self.wp : wp // ignore: cast_nullable_to_non_nullable + as bool?, + hsh: freezed == hsh + ? _self.hsh + : hsh // ignore: cast_nullable_to_non_nullable + as String?, + drk: freezed == drk + ? _self.drk + : drk // ignore: cast_nullable_to_non_nullable + as int?, + top: freezed == top + ? _self.top + : top // ignore: cast_nullable_to_non_nullable + as int?, + bot: freezed == bot + ? _self.bot + : bot // ignore: cast_nullable_to_non_nullable + as int?, + hs: freezed == hs ? _self.hs : hs // ignore: cast_nullable_to_non_nullable + as List?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Images implements Images { + const _Images( + {this.startdate, this.fullstartdate, this.enddate, this.url, this.urlbase, this.copyright, this.copyrightlink, this.title, this.quiz, this.wp, this.hsh, this.drk, this.top, this.bot, final List< + dynamic>? hs}) : _hs = hs; + + factory _Images.fromJson(Map json) => _$ImagesFromJson(json); + + @override final String? startdate; + @override final String? fullstartdate; + @override final String? enddate; + @override final String? url; + @override final String? urlbase; + @override final String? copyright; + @override final String? copyrightlink; + @override final String? title; + @override final String? quiz; + @override final bool? wp; + @override final String? hsh; + @override final int? drk; + @override final int? top; + @override final int? bot; + final List? _hs; + + @override List? get hs { + final value = _hs; + if (value == null) return null; + if (_hs is EqualUnmodifiableListView) return _hs; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + + /// Create a copy of Images + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ImagesCopyWith<_Images> get copyWith => + __$ImagesCopyWithImpl<_Images>(this, _$identity); + + @override + Map toJson() { + return _$ImagesToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Images && + (identical(other.startdate, startdate) || + other.startdate == startdate) && + (identical(other.fullstartdate, fullstartdate) || + other.fullstartdate == fullstartdate) && + (identical(other.enddate, enddate) || other.enddate == enddate) && + (identical(other.url, url) || other.url == url) && + (identical(other.urlbase, urlbase) || other.urlbase == urlbase) && + (identical(other.copyright, copyright) || + other.copyright == copyright) && + (identical(other.copyrightlink, copyrightlink) || + other.copyrightlink == copyrightlink) && + (identical(other.title, title) || other.title == title) && + (identical(other.quiz, quiz) || other.quiz == quiz) && + (identical(other.wp, wp) || other.wp == wp) && + (identical(other.hsh, hsh) || other.hsh == hsh) && + (identical(other.drk, drk) || other.drk == drk) && + (identical(other.top, top) || other.top == top) && + (identical(other.bot, bot) || other.bot == bot) && + const DeepCollectionEquality().equals(other._hs, _hs)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + startdate, + fullstartdate, + enddate, + url, + urlbase, + copyright, + copyrightlink, + title, + quiz, + wp, + hsh, + drk, + top, + bot, + const DeepCollectionEquality().hash(_hs)); + + @override + String toString() { + return 'Images(startdate: $startdate, fullstartdate: $fullstartdate, enddate: $enddate, url: $url, urlbase: $urlbase, copyright: $copyright, copyrightlink: $copyrightlink, title: $title, quiz: $quiz, wp: $wp, hsh: $hsh, drk: $drk, top: $top, bot: $bot, hs: $hs)'; + } + + +} + +/// @nodoc +abstract mixin class _$ImagesCopyWith<$Res> implements $ImagesCopyWith<$Res> { + factory _$ImagesCopyWith(_Images value, + $Res Function(_Images) _then) = __$ImagesCopyWithImpl; + + @override + @useResult + $Res call({ + String? startdate, String? fullstartdate, String? enddate, String? url, String? urlbase, String? copyright, String? copyrightlink, String? title, String? quiz, bool? wp, String? hsh, int? drk, int? top, int? bot, List< + dynamic>? hs + }); + + +} + +/// @nodoc +class __$ImagesCopyWithImpl<$Res> + implements _$ImagesCopyWith<$Res> { + __$ImagesCopyWithImpl(this._self, this._then); + + final _Images _self; + final $Res Function(_Images) _then; + + /// Create a copy of Images + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? startdate = freezed, Object? fullstartdate = freezed, Object? enddate = freezed, Object? url = freezed, Object? urlbase = freezed, Object? copyright = freezed, Object? copyrightlink = freezed, Object? title = freezed, Object? quiz = freezed, Object? wp = freezed, Object? hsh = freezed, Object? drk = freezed, Object? top = freezed, Object? bot = freezed, Object? hs = freezed,}) { + return _then(_Images( + startdate: freezed == startdate + ? _self.startdate + : startdate // ignore: cast_nullable_to_non_nullable + as String?, + fullstartdate: freezed == fullstartdate + ? _self.fullstartdate + : fullstartdate // ignore: cast_nullable_to_non_nullable + as String?, + enddate: freezed == enddate + ? _self.enddate + : enddate // ignore: cast_nullable_to_non_nullable + as String?, + url: freezed == url + ? _self.url + : url // ignore: cast_nullable_to_non_nullable + as String?, + urlbase: freezed == urlbase + ? _self.urlbase + : urlbase // ignore: cast_nullable_to_non_nullable + as String?, + copyright: freezed == copyright + ? _self.copyright + : copyright // ignore: cast_nullable_to_non_nullable + as String?, + copyrightlink: freezed == copyrightlink + ? _self.copyrightlink + : copyrightlink // ignore: cast_nullable_to_non_nullable + as String?, + title: freezed == title + ? _self.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + quiz: freezed == quiz + ? _self.quiz + : quiz // ignore: cast_nullable_to_non_nullable + as String?, + wp: freezed == wp ? _self.wp : wp // ignore: cast_nullable_to_non_nullable + as bool?, + hsh: freezed == hsh + ? _self.hsh + : hsh // ignore: cast_nullable_to_non_nullable + as String?, + drk: freezed == drk + ? _self.drk + : drk // ignore: cast_nullable_to_non_nullable + as int?, + top: freezed == top + ? _self.top + : top // ignore: cast_nullable_to_non_nullable + as int?, + bot: freezed == bot + ? _self.bot + : bot // ignore: cast_nullable_to_non_nullable + as int?, + hs: freezed == hs + ? _self._hs + : hs // ignore: cast_nullable_to_non_nullable + as List?, + )); + } + + +} + +// dart format on diff --git a/lib/common/models/image.g.dart b/lib/common/models/image.g.dart new file mode 100644 index 0000000..234cf41 --- /dev/null +++ b/lib/common/models/image.g.dart @@ -0,0 +1,76 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'image.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_BingImage _$BingImageFromJson(Map json) => _BingImage( + images: + (json['images'] as List?) + ?.map((e) => Images.fromJson(e as Map)) + .toList(), + tooltips: + json['tooltips'] == null + ? null + : Tooltips.fromJson(json['tooltips'] as Map), +); + +Map _$BingImageToJson(_BingImage instance) => + { + if (instance.images case final value?) 'images': value, + if (instance.tooltips case final value?) 'tooltips': value, + }; + +_Tooltips _$TooltipsFromJson(Map json) => _Tooltips( + loading: json['loading'] as String?, + previous: json['previous'] as String?, + next: json['next'] as String?, + walle: json['walle'] as String?, + walls: json['walls'] as String?, +); + +Map _$TooltipsToJson(_Tooltips instance) => { + if (instance.loading case final value?) 'loading': value, + if (instance.previous case final value?) 'previous': value, + if (instance.next case final value?) 'next': value, + if (instance.walle case final value?) 'walle': value, + if (instance.walls case final value?) 'walls': value, +}; + +_Images _$ImagesFromJson(Map json) => _Images( + startdate: json['startdate'] as String?, + fullstartdate: json['fullstartdate'] as String?, + enddate: json['enddate'] as String?, + url: json['url'] as String?, + urlbase: json['urlbase'] as String?, + copyright: json['copyright'] as String?, + copyrightlink: json['copyrightlink'] as String?, + title: json['title'] as String?, + quiz: json['quiz'] as String?, + wp: json['wp'] as bool?, + hsh: json['hsh'] as String?, + drk: (json['drk'] as num?)?.toInt(), + top: (json['top'] as num?)?.toInt(), + bot: (json['bot'] as num?)?.toInt(), + hs: json['hs'] as List?, +); + +Map _$ImagesToJson(_Images instance) => { + if (instance.startdate case final value?) 'startdate': value, + if (instance.fullstartdate case final value?) 'fullstartdate': value, + if (instance.enddate case final value?) 'enddate': value, + if (instance.url case final value?) 'url': value, + if (instance.urlbase case final value?) 'urlbase': value, + if (instance.copyright case final value?) 'copyright': value, + if (instance.copyrightlink case final value?) 'copyrightlink': value, + if (instance.title case final value?) 'title': value, + if (instance.quiz case final value?) 'quiz': value, + if (instance.wp case final value?) 'wp': value, + if (instance.hsh case final value?) 'hsh': value, + if (instance.drk case final value?) 'drk': value, + if (instance.top case final value?) 'top': value, + if (instance.bot case final value?) 'bot': value, + if (instance.hs case final value?) 'hs': value, +}; diff --git a/lib/common/models/weather.dart b/lib/common/models/weather.dart index cbf0cea..63b6710 100644 --- a/lib/common/models/weather.dart +++ b/lib/common/models/weather.dart @@ -1,136 +1,48 @@ -class WeatherResponse { - String? code; - String? updateTime; - String? fxLink; - Now? now; - Refer? refer; +import 'package:freezed_annotation/freezed_annotation.dart'; - WeatherResponse({ - this.code, - this.updateTime, - this.fxLink, - this.now, - this.refer, - }); +part 'weather.freezed.dart'; +part 'weather.g.dart'; - WeatherResponse.fromJson(Map json) { - code = json["code"]; - updateTime = json["updateTime"]; - fxLink = json["fxLink"]; - now = json["now"] == null ? null : Now.fromJson(json["now"]); - refer = json["refer"] == null ? null : Refer.fromJson(json["refer"]); - } +@freezed +abstract class WeatherResponse with _$WeatherResponse { + const factory WeatherResponse({ + String? code, + String? updateTime, + String? fxLink, + Now? now, + Refer? refer, + }) = _WeatherResponse; - Map toJson() { - final Map data = {}; - data["code"] = code; - data["updateTime"] = updateTime; - data["fxLink"] = fxLink; - if (now != null) { - data["now"] = now?.toJson(); - } - if (refer != null) { - data["refer"] = refer?.toJson(); - } - return data; - } + factory WeatherResponse.fromJson(Map json) => + _$WeatherResponseFromJson(json); } -class Refer { - List? sources; - List? license; +@freezed +abstract class Refer with _$Refer { + const factory Refer({List? sources, List? license}) = _Refer; - Refer({this.sources, this.license}); - - Refer.fromJson(Map json) { - sources = - json["sources"] == null ? null : List.from(json["sources"]); - license = - json["license"] == null ? null : List.from(json["license"]); - } - - Map toJson() { - final Map data = {}; - if (sources != null) { - data["sources"] = sources; - } - if (license != null) { - data["license"] = license; - } - return data; - } + factory Refer.fromJson(Map json) => _$ReferFromJson(json); } -class Now { - String? obsTime; - String? temp; - String? feelsLike; - String? icon; - String? text; - String? wind360; - String? windDir; - String? windScale; - String? windSpeed; - String? humidity; - String? precip; - String? pressure; - String? vis; - String? cloud; - String? dew; +@freezed +abstract class Now with _$Now { + const factory Now({ + String? obsTime, + String? temp, + String? feelsLike, + String? icon, + String? text, + String? wind360, + String? windDir, + String? windScale, + String? windSpeed, + String? humidity, + String? precip, + String? pressure, + String? vis, + String? cloud, + String? dew, + }) = _Now; - Now({ - this.obsTime, - this.temp, - this.feelsLike, - this.icon, - this.text, - this.wind360, - this.windDir, - this.windScale, - this.windSpeed, - this.humidity, - this.precip, - this.pressure, - this.vis, - this.cloud, - this.dew, - }); - - Now.fromJson(Map json) { - obsTime = json["obsTime"]; - temp = json["temp"]; - feelsLike = json["feelsLike"]; - icon = json["icon"]; - text = json["text"]; - wind360 = json["wind360"]; - windDir = json["windDir"]; - windScale = json["windScale"]; - windSpeed = json["windSpeed"]; - humidity = json["humidity"]; - precip = json["precip"]; - pressure = json["pressure"]; - vis = json["vis"]; - cloud = json["cloud"]; - dew = json["dew"]; - } - - Map toJson() { - final Map data = {}; - data["obsTime"] = obsTime; - data["temp"] = temp; - data["feelsLike"] = feelsLike; - data["icon"] = icon; - data["text"] = text; - data["wind360"] = wind360; - data["windDir"] = windDir; - data["windScale"] = windScale; - data["windSpeed"] = windSpeed; - data["humidity"] = humidity; - data["precip"] = precip; - data["pressure"] = pressure; - data["vis"] = vis; - data["cloud"] = cloud; - data["dew"] = dew; - return data; - } + factory Now.fromJson(Map json) => _$NowFromJson(json); } diff --git a/lib/common/models/weather.freezed.dart b/lib/common/models/weather.freezed.dart new file mode 100644 index 0000000..7327adb --- /dev/null +++ b/lib/common/models/weather.freezed.dart @@ -0,0 +1,861 @@ +// dart format width=80 +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'weather.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$WeatherResponse { + + String? get code; + + String? get updateTime; + + String? get fxLink; + + Now? get now; + + Refer? get refer; + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $WeatherResponseCopyWith get copyWith => + _$WeatherResponseCopyWithImpl( + this as WeatherResponse, _$identity); + + /// Serializes this WeatherResponse to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is WeatherResponse && + (identical(other.code, code) || other.code == code) && + (identical(other.updateTime, updateTime) || + other.updateTime == updateTime) && + (identical(other.fxLink, fxLink) || other.fxLink == fxLink) && + (identical(other.now, now) || other.now == now) && + (identical(other.refer, refer) || other.refer == refer)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, code, updateTime, fxLink, now, refer); + + @override + String toString() { + return 'WeatherResponse(code: $code, updateTime: $updateTime, fxLink: $fxLink, now: $now, refer: $refer)'; + } + + +} + +/// @nodoc +abstract mixin class $WeatherResponseCopyWith<$Res> { + factory $WeatherResponseCopyWith(WeatherResponse value, + $Res Function(WeatherResponse) _then) = _$WeatherResponseCopyWithImpl; + + @useResult + $Res call({ + String? code, String? updateTime, String? fxLink, Now? now, Refer? refer + }); + + + $NowCopyWith<$Res>? get now; + + $ReferCopyWith<$Res>? get refer; + +} + +/// @nodoc +class _$WeatherResponseCopyWithImpl<$Res> + implements $WeatherResponseCopyWith<$Res> { + _$WeatherResponseCopyWithImpl(this._self, this._then); + + final WeatherResponse _self; + final $Res Function(WeatherResponse) _then; + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? code = freezed, Object? updateTime = freezed, Object? fxLink = freezed, Object? now = freezed, Object? refer = freezed,}) { + return _then(_self.copyWith( + code: freezed == code + ? _self.code + : code // ignore: cast_nullable_to_non_nullable + as String?, + updateTime: freezed == updateTime + ? _self.updateTime + : updateTime // ignore: cast_nullable_to_non_nullable + as String?, + fxLink: freezed == fxLink + ? _self.fxLink + : fxLink // ignore: cast_nullable_to_non_nullable + as String?, + now: freezed == now + ? _self.now + : now // ignore: cast_nullable_to_non_nullable + as Now?, + refer: freezed == refer + ? _self.refer + : refer // ignore: cast_nullable_to_non_nullable + as Refer?, + )); + } + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $NowCopyWith<$Res>? get now { + if (_self.now == null) { + return null; + } + + return $NowCopyWith<$Res>(_self.now!, (value) { + return _then(_self.copyWith(now: value)); + }); + } + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ReferCopyWith<$Res>? get refer { + if (_self.refer == null) { + return null; + } + + return $ReferCopyWith<$Res>(_self.refer!, (value) { + return _then(_self.copyWith(refer: value)); + }); + } +} + + +/// @nodoc +@JsonSerializable() +class _WeatherResponse implements WeatherResponse { + const _WeatherResponse( + {this.code, this.updateTime, this.fxLink, this.now, this.refer}); + + factory _WeatherResponse.fromJson(Map json) => + _$WeatherResponseFromJson(json); + + @override final String? code; + @override final String? updateTime; + @override final String? fxLink; + @override final Now? now; + @override final Refer? refer; + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$WeatherResponseCopyWith<_WeatherResponse> get copyWith => + __$WeatherResponseCopyWithImpl<_WeatherResponse>(this, _$identity); + + @override + Map toJson() { + return _$WeatherResponseToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _WeatherResponse && + (identical(other.code, code) || other.code == code) && + (identical(other.updateTime, updateTime) || + other.updateTime == updateTime) && + (identical(other.fxLink, fxLink) || other.fxLink == fxLink) && + (identical(other.now, now) || other.now == now) && + (identical(other.refer, refer) || other.refer == refer)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, code, updateTime, fxLink, now, refer); + + @override + String toString() { + return 'WeatherResponse(code: $code, updateTime: $updateTime, fxLink: $fxLink, now: $now, refer: $refer)'; + } + + +} + +/// @nodoc +abstract mixin class _$WeatherResponseCopyWith<$Res> + implements $WeatherResponseCopyWith<$Res> { + factory _$WeatherResponseCopyWith(_WeatherResponse value, + $Res Function(_WeatherResponse) _then) = __$WeatherResponseCopyWithImpl; + + @override + @useResult + $Res call({ + String? code, String? updateTime, String? fxLink, Now? now, Refer? refer + }); + + + @override $NowCopyWith<$Res>? get now; + + @override $ReferCopyWith<$Res>? get refer; + +} + +/// @nodoc +class __$WeatherResponseCopyWithImpl<$Res> + implements _$WeatherResponseCopyWith<$Res> { + __$WeatherResponseCopyWithImpl(this._self, this._then); + + final _WeatherResponse _self; + final $Res Function(_WeatherResponse) _then; + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? code = freezed, Object? updateTime = freezed, Object? fxLink = freezed, Object? now = freezed, Object? refer = freezed,}) { + return _then(_WeatherResponse( + code: freezed == code + ? _self.code + : code // ignore: cast_nullable_to_non_nullable + as String?, + updateTime: freezed == updateTime + ? _self.updateTime + : updateTime // ignore: cast_nullable_to_non_nullable + as String?, + fxLink: freezed == fxLink + ? _self.fxLink + : fxLink // ignore: cast_nullable_to_non_nullable + as String?, + now: freezed == now + ? _self.now + : now // ignore: cast_nullable_to_non_nullable + as Now?, + refer: freezed == refer + ? _self.refer + : refer // ignore: cast_nullable_to_non_nullable + as Refer?, + )); + } + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $NowCopyWith<$Res>? get now { + if (_self.now == null) { + return null; + } + + return $NowCopyWith<$Res>(_self.now!, (value) { + return _then(_self.copyWith(now: value)); + }); + } + + /// Create a copy of WeatherResponse + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ReferCopyWith<$Res>? get refer { + if (_self.refer == null) { + return null; + } + + return $ReferCopyWith<$Res>(_self.refer!, (value) { + return _then(_self.copyWith(refer: value)); + }); + } +} + + +/// @nodoc +mixin _$Refer { + + List? get sources; + + List? get license; + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ReferCopyWith get copyWith => + _$ReferCopyWithImpl(this as Refer, _$identity); + + /// Serializes this Refer to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Refer && + const DeepCollectionEquality().equals(other.sources, sources) && + const DeepCollectionEquality().equals(other.license, license)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, const DeepCollectionEquality().hash(sources), + const DeepCollectionEquality().hash(license)); + + @override + String toString() { + return 'Refer(sources: $sources, license: $license)'; + } + + +} + +/// @nodoc +abstract mixin class $ReferCopyWith<$Res> { + factory $ReferCopyWith(Refer value, + $Res Function(Refer) _then) = _$ReferCopyWithImpl; + + @useResult + $Res call({ + List? sources, List? license + }); + + +} + +/// @nodoc +class _$ReferCopyWithImpl<$Res> + implements $ReferCopyWith<$Res> { + _$ReferCopyWithImpl(this._self, this._then); + + final Refer _self; + final $Res Function(Refer) _then; + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({Object? sources = freezed, Object? license = freezed,}) { + return _then(_self.copyWith( + sources: freezed == sources + ? _self.sources + : sources // ignore: cast_nullable_to_non_nullable + as List?, + license: freezed == license + ? _self.license + : license // ignore: cast_nullable_to_non_nullable + as List?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Refer implements Refer { + const _Refer({final List? sources, final List? license}) + : _sources = sources, + _license = license; + + factory _Refer.fromJson(Map json) => _$ReferFromJson(json); + + final List? _sources; + + @override List? get sources { + final value = _sources; + if (value == null) return null; + if (_sources is EqualUnmodifiableListView) return _sources; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + final List? _license; + + @override List? get license { + final value = _license; + if (value == null) return null; + if (_license is EqualUnmodifiableListView) return _license; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ReferCopyWith<_Refer> get copyWith => + __$ReferCopyWithImpl<_Refer>(this, _$identity); + + @override + Map toJson() { + return _$ReferToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Refer && + const DeepCollectionEquality().equals(other._sources, _sources) && + const DeepCollectionEquality().equals(other._license, _license)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, const DeepCollectionEquality().hash(_sources), + const DeepCollectionEquality().hash(_license)); + + @override + String toString() { + return 'Refer(sources: $sources, license: $license)'; + } + + +} + +/// @nodoc +abstract mixin class _$ReferCopyWith<$Res> implements $ReferCopyWith<$Res> { + factory _$ReferCopyWith(_Refer value, + $Res Function(_Refer) _then) = __$ReferCopyWithImpl; + + @override + @useResult + $Res call({ + List? sources, List? license + }); + + +} + +/// @nodoc +class __$ReferCopyWithImpl<$Res> + implements _$ReferCopyWith<$Res> { + __$ReferCopyWithImpl(this._self, this._then); + + final _Refer _self; + final $Res Function(_Refer) _then; + + /// Create a copy of Refer + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call({Object? sources = freezed, Object? license = freezed,}) { + return _then(_Refer( + sources: freezed == sources + ? _self._sources + : sources // ignore: cast_nullable_to_non_nullable + as List?, + license: freezed == license + ? _self._license + : license // ignore: cast_nullable_to_non_nullable + as List?, + )); + } + + +} + + +/// @nodoc +mixin _$Now { + + String? get obsTime; + + String? get temp; + + String? get feelsLike; + + String? get icon; + + String? get text; + + String? get wind360; + + String? get windDir; + + String? get windScale; + + String? get windSpeed; + + String? get humidity; + + String? get precip; + + String? get pressure; + + String? get vis; + + String? get cloud; + + String? get dew; + + /// Create a copy of Now + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $NowCopyWith get copyWith => + _$NowCopyWithImpl(this as Now, _$identity); + + /// Serializes this Now to a JSON map. + Map toJson(); + + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is Now && + (identical(other.obsTime, obsTime) || other.obsTime == obsTime) && + (identical(other.temp, temp) || other.temp == temp) && + (identical(other.feelsLike, feelsLike) || + other.feelsLike == feelsLike) && + (identical(other.icon, icon) || other.icon == icon) && + (identical(other.text, text) || other.text == text) && + (identical(other.wind360, wind360) || other.wind360 == wind360) && + (identical(other.windDir, windDir) || other.windDir == windDir) && + (identical(other.windScale, windScale) || + other.windScale == windScale) && + (identical(other.windSpeed, windSpeed) || + other.windSpeed == windSpeed) && + (identical(other.humidity, humidity) || + other.humidity == humidity) && + (identical(other.precip, precip) || other.precip == precip) && + (identical(other.pressure, pressure) || + other.pressure == pressure) && + (identical(other.vis, vis) || other.vis == vis) && + (identical(other.cloud, cloud) || other.cloud == cloud) && + (identical(other.dew, dew) || other.dew == dew)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + obsTime, + temp, + feelsLike, + icon, + text, + wind360, + windDir, + windScale, + windSpeed, + humidity, + precip, + pressure, + vis, + cloud, + dew); + + @override + String toString() { + return 'Now(obsTime: $obsTime, temp: $temp, feelsLike: $feelsLike, icon: $icon, text: $text, wind360: $wind360, windDir: $windDir, windScale: $windScale, windSpeed: $windSpeed, humidity: $humidity, precip: $precip, pressure: $pressure, vis: $vis, cloud: $cloud, dew: $dew)'; + } + + +} + +/// @nodoc +abstract mixin class $NowCopyWith<$Res> { + factory $NowCopyWith(Now value, $Res Function(Now) _then) = _$NowCopyWithImpl; + + @useResult + $Res call({ + String? obsTime, String? temp, String? feelsLike, String? icon, String? text, String? wind360, String? windDir, String? windScale, String? windSpeed, String? humidity, String? precip, String? pressure, String? vis, String? cloud, String? dew + }); + + +} + +/// @nodoc +class _$NowCopyWithImpl<$Res> + implements $NowCopyWith<$Res> { + _$NowCopyWithImpl(this._self, this._then); + + final Now _self; + final $Res Function(Now) _then; + + /// Create a copy of Now + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call( + {Object? obsTime = freezed, Object? temp = freezed, Object? feelsLike = freezed, Object? icon = freezed, Object? text = freezed, Object? wind360 = freezed, Object? windDir = freezed, Object? windScale = freezed, Object? windSpeed = freezed, Object? humidity = freezed, Object? precip = freezed, Object? pressure = freezed, Object? vis = freezed, Object? cloud = freezed, Object? dew = freezed,}) { + return _then(_self.copyWith( + obsTime: freezed == obsTime + ? _self.obsTime + : obsTime // ignore: cast_nullable_to_non_nullable + as String?, + temp: freezed == temp + ? _self.temp + : temp // ignore: cast_nullable_to_non_nullable + as String?, + feelsLike: freezed == feelsLike + ? _self.feelsLike + : feelsLike // ignore: cast_nullable_to_non_nullable + as String?, + icon: freezed == icon + ? _self.icon + : icon // ignore: cast_nullable_to_non_nullable + as String?, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + wind360: freezed == wind360 + ? _self.wind360 + : wind360 // ignore: cast_nullable_to_non_nullable + as String?, + windDir: freezed == windDir + ? _self.windDir + : windDir // ignore: cast_nullable_to_non_nullable + as String?, + windScale: freezed == windScale + ? _self.windScale + : windScale // ignore: cast_nullable_to_non_nullable + as String?, + windSpeed: freezed == windSpeed + ? _self.windSpeed + : windSpeed // ignore: cast_nullable_to_non_nullable + as String?, + humidity: freezed == humidity + ? _self.humidity + : humidity // ignore: cast_nullable_to_non_nullable + as String?, + precip: freezed == precip + ? _self.precip + : precip // ignore: cast_nullable_to_non_nullable + as String?, + pressure: freezed == pressure + ? _self.pressure + : pressure // ignore: cast_nullable_to_non_nullable + as String?, + vis: freezed == vis + ? _self.vis + : vis // ignore: cast_nullable_to_non_nullable + as String?, + cloud: freezed == cloud + ? _self.cloud + : cloud // ignore: cast_nullable_to_non_nullable + as String?, + dew: freezed == dew + ? _self.dew + : dew // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + +} + + +/// @nodoc +@JsonSerializable() +class _Now implements Now { + const _Now( + {this.obsTime, this.temp, this.feelsLike, this.icon, this.text, this.wind360, this.windDir, this.windScale, this.windSpeed, this.humidity, this.precip, this.pressure, this.vis, this.cloud, this.dew}); + + factory _Now.fromJson(Map json) => _$NowFromJson(json); + + @override final String? obsTime; + @override final String? temp; + @override final String? feelsLike; + @override final String? icon; + @override final String? text; + @override final String? wind360; + @override final String? windDir; + @override final String? windScale; + @override final String? windSpeed; + @override final String? humidity; + @override final String? precip; + @override final String? pressure; + @override final String? vis; + @override final String? cloud; + @override final String? dew; + + /// Create a copy of Now + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$NowCopyWith<_Now> get copyWith => + __$NowCopyWithImpl<_Now>(this, _$identity); + + @override + Map toJson() { + return _$NowToJson(this,); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _Now && + (identical(other.obsTime, obsTime) || other.obsTime == obsTime) && + (identical(other.temp, temp) || other.temp == temp) && + (identical(other.feelsLike, feelsLike) || + other.feelsLike == feelsLike) && + (identical(other.icon, icon) || other.icon == icon) && + (identical(other.text, text) || other.text == text) && + (identical(other.wind360, wind360) || other.wind360 == wind360) && + (identical(other.windDir, windDir) || other.windDir == windDir) && + (identical(other.windScale, windScale) || + other.windScale == windScale) && + (identical(other.windSpeed, windSpeed) || + other.windSpeed == windSpeed) && + (identical(other.humidity, humidity) || + other.humidity == humidity) && + (identical(other.precip, precip) || other.precip == precip) && + (identical(other.pressure, pressure) || + other.pressure == pressure) && + (identical(other.vis, vis) || other.vis == vis) && + (identical(other.cloud, cloud) || other.cloud == cloud) && + (identical(other.dew, dew) || other.dew == dew)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash( + runtimeType, + obsTime, + temp, + feelsLike, + icon, + text, + wind360, + windDir, + windScale, + windSpeed, + humidity, + precip, + pressure, + vis, + cloud, + dew); + + @override + String toString() { + return 'Now(obsTime: $obsTime, temp: $temp, feelsLike: $feelsLike, icon: $icon, text: $text, wind360: $wind360, windDir: $windDir, windScale: $windScale, windSpeed: $windSpeed, humidity: $humidity, precip: $precip, pressure: $pressure, vis: $vis, cloud: $cloud, dew: $dew)'; + } + + +} + +/// @nodoc +abstract mixin class _$NowCopyWith<$Res> implements $NowCopyWith<$Res> { + factory _$NowCopyWith(_Now value, + $Res Function(_Now) _then) = __$NowCopyWithImpl; + + @override + @useResult + $Res call({ + String? obsTime, String? temp, String? feelsLike, String? icon, String? text, String? wind360, String? windDir, String? windScale, String? windSpeed, String? humidity, String? precip, String? pressure, String? vis, String? cloud, String? dew + }); + + +} + +/// @nodoc +class __$NowCopyWithImpl<$Res> + implements _$NowCopyWith<$Res> { + __$NowCopyWithImpl(this._self, this._then); + + final _Now _self; + final $Res Function(_Now) _then; + + /// Create a copy of Now + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $Res call( + {Object? obsTime = freezed, Object? temp = freezed, Object? feelsLike = freezed, Object? icon = freezed, Object? text = freezed, Object? wind360 = freezed, Object? windDir = freezed, Object? windScale = freezed, Object? windSpeed = freezed, Object? humidity = freezed, Object? precip = freezed, Object? pressure = freezed, Object? vis = freezed, Object? cloud = freezed, Object? dew = freezed,}) { + return _then(_Now( + obsTime: freezed == obsTime + ? _self.obsTime + : obsTime // ignore: cast_nullable_to_non_nullable + as String?, + temp: freezed == temp + ? _self.temp + : temp // ignore: cast_nullable_to_non_nullable + as String?, + feelsLike: freezed == feelsLike + ? _self.feelsLike + : feelsLike // ignore: cast_nullable_to_non_nullable + as String?, + icon: freezed == icon + ? _self.icon + : icon // ignore: cast_nullable_to_non_nullable + as String?, + text: freezed == text + ? _self.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + wind360: freezed == wind360 + ? _self.wind360 + : wind360 // ignore: cast_nullable_to_non_nullable + as String?, + windDir: freezed == windDir + ? _self.windDir + : windDir // ignore: cast_nullable_to_non_nullable + as String?, + windScale: freezed == windScale + ? _self.windScale + : windScale // ignore: cast_nullable_to_non_nullable + as String?, + windSpeed: freezed == windSpeed + ? _self.windSpeed + : windSpeed // ignore: cast_nullable_to_non_nullable + as String?, + humidity: freezed == humidity + ? _self.humidity + : humidity // ignore: cast_nullable_to_non_nullable + as String?, + precip: freezed == precip + ? _self.precip + : precip // ignore: cast_nullable_to_non_nullable + as String?, + pressure: freezed == pressure + ? _self.pressure + : pressure // ignore: cast_nullable_to_non_nullable + as String?, + vis: freezed == vis + ? _self.vis + : vis // ignore: cast_nullable_to_non_nullable + as String?, + cloud: freezed == cloud + ? _self.cloud + : cloud // ignore: cast_nullable_to_non_nullable + as String?, + dew: freezed == dew + ? _self.dew + : dew // ignore: cast_nullable_to_non_nullable + as String?, + )); + } + + +} + +// dart format on diff --git a/lib/common/models/weather.g.dart b/lib/common/models/weather.g.dart new file mode 100644 index 0000000..84f8dc4 --- /dev/null +++ b/lib/common/models/weather.g.dart @@ -0,0 +1,79 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'weather.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_WeatherResponse _$WeatherResponseFromJson(Map json) => + _WeatherResponse( + code: json['code'] as String?, + updateTime: json['updateTime'] as String?, + fxLink: json['fxLink'] as String?, + now: + json['now'] == null + ? null + : Now.fromJson(json['now'] as Map), + refer: + json['refer'] == null + ? null + : Refer.fromJson(json['refer'] as Map), + ); + +Map _$WeatherResponseToJson(_WeatherResponse instance) => + { + if (instance.code case final value?) 'code': value, + if (instance.updateTime case final value?) 'updateTime': value, + if (instance.fxLink case final value?) 'fxLink': value, + if (instance.now case final value?) 'now': value, + if (instance.refer case final value?) 'refer': value, + }; + +_Refer _$ReferFromJson(Map json) => _Refer( + sources: + (json['sources'] as List?)?.map((e) => e as String).toList(), + license: + (json['license'] as List?)?.map((e) => e as String).toList(), +); + +Map _$ReferToJson(_Refer instance) => { + if (instance.sources case final value?) 'sources': value, + if (instance.license case final value?) 'license': value, +}; + +_Now _$NowFromJson(Map json) => _Now( + obsTime: json['obsTime'] as String?, + temp: json['temp'] as String?, + feelsLike: json['feelsLike'] as String?, + icon: json['icon'] as String?, + text: json['text'] as String?, + wind360: json['wind360'] as String?, + windDir: json['windDir'] as String?, + windScale: json['windScale'] as String?, + windSpeed: json['windSpeed'] as String?, + humidity: json['humidity'] as String?, + precip: json['precip'] as String?, + pressure: json['pressure'] as String?, + vis: json['vis'] as String?, + cloud: json['cloud'] as String?, + dew: json['dew'] as String?, +); + +Map _$NowToJson(_Now instance) => { + if (instance.obsTime case final value?) 'obsTime': value, + if (instance.temp case final value?) 'temp': value, + if (instance.feelsLike case final value?) 'feelsLike': value, + if (instance.icon case final value?) 'icon': value, + if (instance.text case final value?) 'text': value, + if (instance.wind360 case final value?) 'wind360': value, + if (instance.windDir case final value?) 'windDir': value, + if (instance.windScale case final value?) 'windScale': value, + if (instance.windSpeed case final value?) 'windSpeed': value, + if (instance.humidity case final value?) 'humidity': value, + if (instance.precip case final value?) 'precip': value, + if (instance.pressure case final value?) 'pressure': value, + if (instance.vis case final value?) 'vis': value, + if (instance.cloud case final value?) 'cloud': value, + if (instance.dew case final value?) 'dew': value, +}; diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 9e70cdc..5fea45e 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -62,8 +62,7 @@ import 'app_localizations_zh.dart'; /// be consistent with the languages listed in the AppLocalizations.supportedLocales /// property. abstract class AppLocalizations { - AppLocalizations(String locale) - : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString()); final String localeName; @@ -71,8 +70,7 @@ abstract class AppLocalizations { return Localizations.of(context, AppLocalizations); } - static const LocalizationsDelegate delegate = - _AppLocalizationsDelegate(); + static const LocalizationsDelegate delegate = _AppLocalizationsDelegate(); /// A list of this localizations delegate along with the default localizations /// delegates. @@ -84,18 +82,17 @@ abstract class AppLocalizations { /// Additional delegates can be added by appending to this list in /// MaterialApp. This list does not have to be used at all if a custom list /// of delegates is preferred or required. - static const List> localizationsDelegates = - >[ - delegate, - GlobalMaterialLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - ]; + static const List> localizationsDelegates = >[ + delegate, + GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ]; /// A list of this localizations delegate's supported locales. static const List supportedLocales = [ Locale('en'), - Locale('zh'), + Locale('zh') ]; /// No description provided for @ok. @@ -1833,8 +1830,7 @@ abstract class AppLocalizations { String get labTencentCloud; } -class _AppLocalizationsDelegate - extends LocalizationsDelegate { +class _AppLocalizationsDelegate extends LocalizationsDelegate { const _AppLocalizationsDelegate(); @override @@ -1843,26 +1839,25 @@ class _AppLocalizationsDelegate } @override - bool isSupported(Locale locale) => - ['en', 'zh'].contains(locale.languageCode); + bool isSupported(Locale locale) => ['en', 'zh'].contains(locale.languageCode); @override bool shouldReload(_AppLocalizationsDelegate old) => false; } AppLocalizations lookupAppLocalizations(Locale locale) { + + // Lookup logic when only language code is specified. switch (locale.languageCode) { - case 'en': - return AppLocalizationsEn(); - case 'zh': - return AppLocalizationsZh(); + case 'en': return AppLocalizationsEn(); + case 'zh': return AppLocalizationsZh(); } throw FlutterError( 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' 'an issue with the localizations generation tool. Please file an issue ' 'on GitHub with a reproducible sample app and the gen-l10n configuration ' - 'that was used.', + 'that was used.' ); } diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 93a7f8a..428d08c 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -1,6 +1,5 @@ // ignore: unused_import import 'package:intl/intl.dart' as intl; - import 'app_localizations.dart'; // ignore_for_file: type=lint @@ -46,8 +45,7 @@ class AppLocalizationsEn extends AppLocalizations { String get startTitle3 => 'An ad-free, social-free, intimate diary'; @override - String get welcome1 => - 'Thanks for downloading this product! Before use, we hope you can read and understand our '; + String get welcome1 => 'Thanks for downloading this product! Before use, we hope you can read and understand our '; @override String get welcome2 => 'Privacy Policy '; @@ -59,8 +57,7 @@ class AppLocalizationsEn extends AppLocalizations { String get welcome4 => 'User Agreement'; @override - String get welcome5 => - '. We always respect and will strictly protect your legitimate rights and interests when using this product from any infringement. If you begin to use this product, you will be deemed to have accepted this Agreement. If you do not accept all the terms of this Agreement, do not begin to use this Product.'; + String get welcome5 => '. We always respect and will strictly protect your legitimate rights and interests when using this product from any infringement. If you begin to use this product, you will be deemed to have accepted this Agreement. If you do not accept all the terms of this Agreement, do not begin to use this Product.'; @override String get startChoice1 => 'Exit'; @@ -72,8 +69,7 @@ class AppLocalizationsEn extends AppLocalizations { String get permission1 => 'Permission grant'; @override - String get permission2 => - 'In order to better use the experience, we need the following permissions'; + String get permission2 => 'In order to better use the experience, we need the following permissions'; @override String get permission3 => '• Location permission (for getting the weather)'; @@ -118,8 +114,7 @@ class AppLocalizationsEn extends AppLocalizations { String get settingExportDialogTitle => 'Data Export'; @override - String get settingExportDialogContent => - 'After confirmation, the current application\'s data will be exported as a ZIP file, which can be used for intra application import.'; + String get settingExportDialogContent => 'After confirmation, the current application\'s data will be exported as a ZIP file, which can be used for intra application import.'; @override String get settingImport => 'Import'; @@ -128,8 +123,7 @@ class AppLocalizationsEn extends AppLocalizations { String get settingImportDialogTitle => 'Data Import'; @override - String get settingImportDialogContent => - 'Importing data will overwrite the existing data and the original data cannot be restored! Please confirm that the original data has been backed up.'; + String get settingImportDialogContent => 'Importing data will overwrite the existing data and the original data cannot be restored! Please confirm that the original data has been backed up.'; @override String get settingImportSelectFile => 'Select File'; @@ -195,8 +189,7 @@ class AppLocalizationsEn extends AppLocalizations { String get settingLockSupportBiometricsDes => 'System supports biometrics'; @override - String get settingLockNotSupportBiometricsDes => - 'System does not support biometrics'; + String get settingLockNotSupportBiometricsDes => 'System does not support biometrics'; @override String get settingLockOpen => 'Open'; @@ -214,15 +207,13 @@ class AppLocalizationsEn extends AppLocalizations { String get settingLockChooseLockType => 'Please select a password type'; @override - String get settingLockResetLock => - 'Password has been enabled, reset please close first'; + String get settingLockResetLock => 'Password has been enabled, reset please close first'; @override String get settingBackendPrivacyProtection => 'Background Privacy Protection'; @override - String get settingBackendPrivacyProtectionDes => - 'When the application is in the background, hide the application content'; + String get settingBackendPrivacyProtectionDes => 'When the application is in the background, hide the application content'; @override String get settingUserKey => 'Private Key'; @@ -234,15 +225,13 @@ class AppLocalizationsEn extends AppLocalizations { String get settingUserKeySet => 'Setting key'; @override - String get settingUserKeySetDes => - '⚠️ The key cannot be obtained after setting it, please keep it properly. If you need to use encrypted data on other devices, please make sure to use the same key.'; + String get settingUserKeySetDes => '⚠️ The key cannot be obtained after setting it, please keep it properly. If you need to use encrypted data on other devices, please make sure to use the same key.'; @override String get settingUserKeyReset => 'Reset key'; @override - String get settingUserKeyResetDes => - 'Are you sure you want to reset the key?'; + String get settingUserKeyResetDes => 'Are you sure you want to reset the key?'; @override String get settingUserKeyHasSet => 'Set'; @@ -515,19 +504,16 @@ class AppLocalizationsEn extends AppLocalizations { String get lanTransferChangeTransferPort => 'Change transfer port'; @override - String get lanTransferChangePortDes => - 'Please ensure that the ports of the two devices are consistent. You need to rescan after changing'; + String get lanTransferChangePortDes => 'Please ensure that the ports of the two devices are consistent. You need to rescan after changing'; @override - String get lanTransferChangePortError1 => - 'Please enter the temporary port number (49152-65535)'; + String get lanTransferChangePortError1 => 'Please enter the temporary port number (49152-65535)'; @override String get lanTransferChangePortError2 => 'Please enter the port number'; @override - String get lanTransferReceiveDes => - 'Do not close the application during the receiving process'; + String get lanTransferReceiveDes => 'Do not close the application during the receiving process'; @override String get lanTransferReceiveServerStart => 'The server has started'; @@ -539,22 +525,19 @@ class AppLocalizationsEn extends AppLocalizations { String get webdavSyncWhenStartUp => 'Sync on startup'; @override - String get webdavSyncWhenStartUpDes => - 'Automatically synchronize when starting the application'; + String get webdavSyncWhenStartUpDes => 'Automatically synchronize when starting the application'; @override String get webdavSyncAfterChange => 'Sync after change'; @override - String get webdavSyncAfterChangeDes => - 'Automatically synchronize after changing data'; + String get webdavSyncAfterChangeDes => 'Automatically synchronize after changing data'; @override String get webdavSyncEncryption => 'Encryption'; @override - String get webdavSyncEncryptionDes => - 'Encrypting synchronous data, you need to set a private key'; + String get webdavSyncEncryptionDes => 'Encrypting synchronous data, you need to set a private key'; @override String get webdavOptionServer => 'Server address'; @@ -587,8 +570,7 @@ class AppLocalizationsEn extends AppLocalizations { String get diarySettingRichText => 'Rich text'; @override - String get diarySettingRichTextDes => - 'Supports more styles and attachments to make content presentation richer'; + String get diarySettingRichTextDes => 'Supports more styles and attachments to make content presentation richer'; @override String get diarySettingShowHeaderImage => 'Diary page display header image'; @@ -597,8 +579,7 @@ class AppLocalizationsEn extends AppLocalizations { String get diarySettingPlainText => 'Plain text'; @override - String get diarySettingPlainTextDes => - 'Remove redundant styles and enjoy a purer writing experience'; + String get diarySettingPlainTextDes => 'Remove redundant styles and enjoy a purer writing experience'; @override String get diarySettingFirstLineIndent => 'Automatic first line indent'; @@ -657,8 +638,7 @@ class AppLocalizationsEn extends AppLocalizations { String get noticeEnableLocation => 'Please enable location permission'; @override - String get noticeEnableLocation2 => - 'Please go to settings to enable location permissions'; + String get noticeEnableLocation2 => 'Please go to settings to enable location permissions'; @override String get diarySearch => 'Search'; @@ -910,8 +890,7 @@ class AppLocalizationsEn extends AppLocalizations { String get inputMethodHandelInput => 'Manual input'; @override - String get getKeyFromConsole => - 'Please get the key from the corresponding console'; + String get getKeyFromConsole => 'Please get the key from the corresponding console'; @override String get hasOption => 'Configured'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index ffdb6a9..db44080 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -1,6 +1,5 @@ // ignore: unused_import import 'package:intl/intl.dart' as intl; - import 'app_localizations.dart'; // ignore_for_file: type=lint @@ -58,8 +57,7 @@ class AppLocalizationsZh extends AppLocalizations { String get welcome4 => '《用户协议》'; @override - String get welcome5 => - '。我们一向尊重并会严格保护您在使用本产品时的合法权益不受到任何侵犯。用户开始使用本产品将视为已经接受本协议,如果您不能接受本协议中的全部条款,请勿开始使用本产品。'; + String get welcome5 => '。我们一向尊重并会严格保护您在使用本产品时的合法权益不受到任何侵犯。用户开始使用本产品将视为已经接受本协议,如果您不能接受本协议中的全部条款,请勿开始使用本产品。'; @override String get startChoice1 => '退出'; @@ -116,8 +114,7 @@ class AppLocalizationsZh extends AppLocalizations { String get settingExportDialogTitle => '数据导出'; @override - String get settingExportDialogContent => - '确认后会将当前应用的数据导出为 ZIP 文件,文件可用于应用内导入使用。'; + String get settingExportDialogContent => '确认后会将当前应用的数据导出为 ZIP 文件,文件可用于应用内导入使用。'; @override String get settingImport => '导入'; @@ -126,8 +123,7 @@ class AppLocalizationsZh extends AppLocalizations { String get settingImportDialogTitle => '数据导入'; @override - String get settingImportDialogContent => - '导入数据会覆盖当前已经有的数据,且原有数据无法恢复!请确认备份好原有数据。'; + String get settingImportDialogContent => '导入数据会覆盖当前已经有的数据,且原有数据无法恢复!请确认备份好原有数据。'; @override String get settingImportSelectFile => '选择文件'; @@ -229,8 +225,7 @@ class AppLocalizationsZh extends AppLocalizations { String get settingUserKeySet => '设置密钥'; @override - String get settingUserKeySetDes => - '⚠️ 密钥设置后无法获取,请妥善保管,如果您需要在其他设备上使用加密数据,请确保使用相同的密钥。'; + String get settingUserKeySetDes => '⚠️ 密钥设置后无法获取,请妥善保管,如果您需要在其他设备上使用加密数据,请确保使用相同的密钥。'; @override String get settingUserKeyReset => '重置密钥'; diff --git a/lib/pages/analyse/analyse_logic.dart b/lib/pages/analyse/analyse_logic.dart index 5a19174..813d0a9 100644 --- a/lib/pages/analyse/analyse_logic.dart +++ b/lib/pages/analyse/analyse_logic.dart @@ -81,11 +81,12 @@ class AnalyseLogic extends GetxController { state.reply = ''; update(); final stream = await Api.getHunYuan(check['id']!, check['key']!, [ - Message( - 'system', - '我会给你一组来自一款日记APP的数据,其中包含了在某一段时间内,日记所记录的心情情况,根据这些数据,分析用户最近的心情状况,并给出合理的建议,心情的值是一个从0.0到1.0的浮点数,从小到大表示心情从坏到好,给你的值是一个Map,其中的Key是心情指数,Value是对应心情指数出现的次数。给出的输出应当是结论,不需要给出分析过程,不需要其他反馈。', + const Message( + role: 'system', + content: + '我会给你一组来自一款日记APP的数据,其中包含了在某一段时间内,日记所记录的心情情况,根据这些数据,分析用户最近的心情状况,并给出合理的建议,心情的值是一个从0.0到1.0的浮点数,从小到大表示心情从坏到好,给你的值是一个Map,其中的Key是心情指数,Value是对应心情指数出现的次数。给出的输出应当是结论,不需要给出分析过程,不需要其他反馈。', ), - Message('user', '心情:${state.moodMap.toString()}'), + Message(role: 'user', content: '心情:${state.moodMap.toString()}'), ], 0); stream?.listen((content) { if (content != '' && content.contains('data')) { diff --git a/lib/pages/assistant/assistant_logic.dart b/lib/pages/assistant/assistant_logic.dart index d314388..9121192 100644 --- a/lib/pages/assistant/assistant_logic.dart +++ b/lib/pages/assistant/assistant_logic.dart @@ -91,7 +91,7 @@ class AssistantLogic extends GetxController { unFocus(); //拿到用户提问后,对话上下文中增加一项用户提问 final askTime = DateTime.now(); - state.messages[askTime] = Message('user', ask); + state.messages[askTime] = Message(role: 'user', content: ask); update(); toBottom(); //带着上下文请求 @@ -103,7 +103,7 @@ class AssistantLogic extends GetxController { ); //如果收到了请求,添加一个回答上下文 final replyTime = DateTime.now(); - state.messages[replyTime] = Message('assistant', ''); + state.messages[replyTime] = const Message(role: 'assistant', content: ''); update(); //接收stream stream?.listen((content) { @@ -111,8 +111,11 @@ class AssistantLogic extends GetxController { final HunyuanResponse result = HunyuanResponse.fromJson( jsonDecode(content.split('data: ')[1]), ); - state.messages[replyTime]!.content += - result.choices!.first.delta!.content!; + final currentMessage = state.messages[replyTime]!; + state.messages[replyTime] = currentMessage.copyWith( + content: + currentMessage.content + result.choices!.first.delta!.content!, + ); HapticFeedback.vibrate(); update(); toBottom(); diff --git a/lib/pages/edit/edit_logic.dart b/lib/pages/edit/edit_logic.dart index 2edda62..6ae7f3e 100644 --- a/lib/pages/edit/edit_logic.dart +++ b/lib/pages/edit/edit_logic.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; +import 'package:dartx/dartx.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -540,44 +541,51 @@ class EditLogic extends GetxController { //获取天气,同时获取定位 Future getPositionAndWeather({required BuildContext context}) async { final key = PrefUtil.getValue('qweatherKey'); - if (key == null) return; + final apiHost = PrefUtil.getValue('qweatherApiHost'); + if (key.isNullOrBlank || apiHost.isNullOrBlank) return; - state.isProcessing = true; - update(['Weather']); + try { + state.isProcessing = true; + update(['Weather']); - // 获取定位 - final position = await Api.updatePosition(context); - if (position == null && context.mounted) { - _handleError(context.l10n.locationError); - return; + // 获取定位 + final position = await Api.updatePosition(context); + if (position == null && context.mounted) { + _handleError(context, context.l10n.locationError); + return; + } + state.currentDiary.position = position!; + if (!context.mounted) return; + // 获取天气 + final weather = await Api.updateWeather( + context: context, + position: LatLng(double.parse(position[0]), double.parse(position[1])), + ); + if (weather == null && context.mounted) { + _handleError(context, context.l10n.weatherError); + return; + } + state.currentDiary.weather = weather!; + state.isProcessing = false; + if (context.mounted) { + toast.success(message: context.l10n.weatherSuccess); + } + update(['Weather']); + } catch (e) { + state.isProcessing = false; + update(['Weather']); + if (context.mounted) { + toast.error(message: context.l10n.weatherError); + } } - - state.currentDiary.position = position!; - - if (!context.mounted) return; - // 获取天气 - final weather = await Api.updateWeather( - context: context, - position: LatLng(double.parse(position[0]), double.parse(position[1])), - ); - - if (weather == null && context.mounted) { - _handleError(context.l10n.weatherError); - return; - } - - state.currentDiary.weather = weather!; - state.isProcessing = false; - if (context.mounted) { - toast.success(message: context.l10n.weatherSuccess); - } - update(['Weather']); } - void _handleError(String message) { + void _handleError(BuildContext context, String message) { state.isProcessing = false; - toast.error(message: message); update(['Weather']); + if (context.mounted) { + toast.error(message: message); + } } Future pickAudio(BuildContext context) async { diff --git a/lib/pages/laboratory/laboratory_logic.dart b/lib/pages/laboratory/laboratory_logic.dart index 91a04ac..d76fd3b 100644 --- a/lib/pages/laboratory/laboratory_logic.dart +++ b/lib/pages/laboratory/laboratory_logic.dart @@ -44,6 +44,17 @@ class LaboratoryLogic extends GetxController { } } + Future setQweatherApiHost({required String host}) async { + try { + await PrefUtil.setValue('qweatherApiHost', host); + return true; + } catch (e) { + return false; + } finally { + update(); + } + } + Future setTiandituKey({required String key}) async { try { await PrefUtil.setValue('tiandituKey', key); diff --git a/lib/pages/laboratory/laboratory_view.dart b/lib/pages/laboratory/laboratory_view.dart index d262245..b80ae12 100644 --- a/lib/pages/laboratory/laboratory_view.dart +++ b/lib/pages/laboratory/laboratory_view.dart @@ -63,6 +63,21 @@ class LaboratoryPage extends StatelessWidget { } }, ), + const Gap(12), + QrInputTile( + title: '${context.l10n.labQweather} API Host', + value: PrefUtil.getValue('qweatherApiHost') ?? '', + prefix: 'qweatherApiHost', + onValue: (value) async { + final res = await logic.setQweatherApiHost(host: value); + if (res) { + toast.success(); + } else { + toast.error(); + } + }, + ), + const Gap(12), QrInputTile( title: '${context.l10n.labTianditu} Key', diff --git a/lib/persistence/pref.dart b/lib/persistence/pref.dart index 3331196..422b591 100644 --- a/lib/persistence/pref.dart +++ b/lib/persistence/pref.dart @@ -42,6 +42,8 @@ class PrefUtil { 'fontTheme', //和风key 'qweatherKey', + // 和风apihost, + 'qweatherApiHost', 'tencentId', 'tencentKey', 'tiandituKey', diff --git a/lib/utils/http_util.dart b/lib/utils/http_util.dart index 0f0088f..2238781 100644 --- a/lib/utils/http_util.dart +++ b/lib/utils/http_util.dart @@ -19,7 +19,10 @@ class HttpUtil { InterceptorsWrapper( onError: (error, handler) { if (error.type != DioExceptionType.cancel) { - toast.error(message: 'Network Error ${error.error}'); + toast.error( + message: + 'Network Error ${error.response?.statusCode} ${error.response?.statusMessage} ${error.message}', + ); } handler.next(error); }, diff --git a/lib/utils/notice_util.dart b/lib/utils/notice_util.dart index 665d2fd..ada08a5 100644 --- a/lib/utils/notice_util.dart +++ b/lib/utils/notice_util.dart @@ -141,7 +141,7 @@ class NoticeUtil { return DecoratedBox( decoration: BoxDecoration( - color: context.theme.colorScheme.surfaceContainerHigh.withValues( + color: context.theme.colorScheme.surfaceContainerHighest.withValues( alpha: 0.9, ), borderRadius: AppBorderRadius.mediumBorderRadius, From 8d9f380ec5e34e2bf8deb6cd3b415c29d8c0160e Mon Sep 17 00:00:00 2001 From: ZhuJHua <1624109111@qq.com> Date: Fri, 18 Apr 2025 11:58:51 +0800 Subject: [PATCH 3/3] Revert "fix: qweather api error" This reverts commit 2e206a93354ab89be53e3ca9541d3ab130d8c61e. --- build.yaml | 19 - lib/api/api.dart | 16 +- lib/common/models/geo.dart | 138 +- lib/common/models/geo.freezed.dart | 768 -------- lib/common/models/geo.g.dart | 70 - lib/common/models/github.dart | 422 ++++- lib/common/models/github.freezed.dart | 1997 -------------------- lib/common/models/github.g.dart | 183 -- lib/common/models/hitokoto.dart | 78 +- lib/common/models/hitokoto.freezed.dart | 370 ---- lib/common/models/hitokoto.g.dart | 39 - lib/common/models/hunyuan.dart | 175 +- lib/common/models/hunyuan.freezed.dart | 1250 ------------ lib/common/models/hunyuan.g.dart | 88 - lib/common/models/image.dart | 160 +- lib/common/models/image.freezed.dart | 825 -------- lib/common/models/image.g.dart | 76 - lib/common/models/weather.dart | 164 +- lib/common/models/weather.freezed.dart | 861 --------- lib/common/models/weather.g.dart | 79 - lib/l10n/app_localizations.dart | 37 +- lib/l10n/app_localizations_en.dart | 61 +- lib/l10n/app_localizations_zh.dart | 13 +- lib/pages/analyse/analyse_logic.dart | 9 +- lib/pages/assistant/assistant_logic.dart | 11 +- lib/pages/edit/edit_logic.dart | 70 +- lib/pages/laboratory/laboratory_logic.dart | 11 - lib/pages/laboratory/laboratory_view.dart | 15 - lib/persistence/pref.dart | 2 - lib/utils/http_util.dart | 5 +- lib/utils/notice_util.dart | 2 +- 31 files changed, 974 insertions(+), 7040 deletions(-) delete mode 100644 build.yaml delete mode 100644 lib/common/models/geo.freezed.dart delete mode 100644 lib/common/models/geo.g.dart delete mode 100644 lib/common/models/github.freezed.dart delete mode 100644 lib/common/models/github.g.dart delete mode 100644 lib/common/models/hitokoto.freezed.dart delete mode 100644 lib/common/models/hitokoto.g.dart delete mode 100644 lib/common/models/hunyuan.freezed.dart delete mode 100644 lib/common/models/hunyuan.g.dart delete mode 100644 lib/common/models/image.freezed.dart delete mode 100644 lib/common/models/image.g.dart delete mode 100644 lib/common/models/weather.freezed.dart delete mode 100644 lib/common/models/weather.g.dart diff --git a/build.yaml b/build.yaml deleted file mode 100644 index 8093126..0000000 --- a/build.yaml +++ /dev/null @@ -1,19 +0,0 @@ -targets: - $default: - builders: - json_serializable: - options: - any_map: false - checked: false - constructor: "" - create_factory: true - create_field_map: false - create_json_keys: false - create_per_field_to_json: false - create_to_json: true - disallow_unrecognized_keys: false - explicit_to_json: false - field_rename: none - generic_argument_factories: false - ignore_unannotated: false - include_if_null: false \ No newline at end of file diff --git a/lib/api/api.dart b/lib/api/api.dart index a3daea2..69f74fe 100644 --- a/lib/api/api.dart +++ b/lib/api/api.dart @@ -36,7 +36,7 @@ class Api { //请求正文 final body = { 'Model': hunyuanModel, - 'Messages': messages.map((value) => value.toJson()).toList(), + 'Messages': messages.map((value) => value.toMap()).toList(), 'Stream': true, }; @@ -49,15 +49,15 @@ class Api { ); //构造请求头 final header = PublicHeader( - action: 'ChatCompletions', - timestamp: timestamp ~/ 1000, - version: '2023-09-01', - authorization: authorization, + 'ChatCompletions', + timestamp ~/ 1000, + '2023-09-01', + authorization, ); //发起请求 return await HttpUtil().postStream( 'https://hunyuan.tencentcloudapi.com', - header: header.toJson(), + header: header.toMap(), data: body, ); } @@ -97,7 +97,7 @@ class Api { 'lang': local, }; final res = await HttpUtil().get( - 'https://${PrefUtil.getValue('qweatherApiHost')}/geo/v2/city/lookup', + 'https://geoapi.qweather.com/v2/city/lookup', parameters: parameters, ); final geo = await compute( @@ -131,7 +131,7 @@ class Api { 'lang': local, }; final res = await HttpUtil().get( - 'https://${PrefUtil.getValue('qweatherApiHost')}/v7/weather/now', + 'https://devapi.qweather.com/v7/weather/now', parameters: parameters, ); final weather = await compute( diff --git a/lib/common/models/geo.dart b/lib/common/models/geo.dart index 9f1a1e1..70078bd 100644 --- a/lib/common/models/geo.dart +++ b/lib/common/models/geo.dart @@ -1,45 +1,113 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +class GeoResponse { + String? code; + List? location; + Refer? refer; -part 'geo.freezed.dart'; -part 'geo.g.dart'; + GeoResponse({this.code, this.location, this.refer}); -@freezed -abstract class GeoResponse with _$GeoResponse { - const factory GeoResponse({ - String? code, - List? location, - Refer? refer, - }) = _GeoResponse; + GeoResponse.fromJson(Map json) { + code = json["code"]; + location = + json["location"] == null + ? null + : (json["location"] as List) + .map((e) => Location.fromJson(e)) + .toList(); + refer = json["refer"] == null ? null : Refer.fromJson(json["refer"]); + } - factory GeoResponse.fromJson(Map json) => - _$GeoResponseFromJson(json); + Map toJson() { + final Map data = {}; + data["code"] = code; + data["location"] = location?.map((e) => e.toJson()).toList(); + data["refer"] = refer?.toJson(); + return data; + } } -@freezed -abstract class Refer with _$Refer { - const factory Refer({List? sources, List? license}) = _Refer; +class Refer { + List? sources; + List? license; - factory Refer.fromJson(Map json) => _$ReferFromJson(json); + Refer({this.sources, this.license}); + + Refer.fromJson(Map json) { + sources = + json["sources"] == null ? null : List.from(json["sources"]); + license = + json["license"] == null ? null : List.from(json["license"]); + } + + Map toJson() { + final Map data = {}; + data["sources"] = sources; + data["license"] = license; + return data; + } } -@freezed -abstract class Location with _$Location { - const factory Location({ - String? name, - String? id, - String? lat, - String? lon, - String? adm2, - String? adm1, - String? country, - String? tz, - String? utcOffset, - String? isDst, - String? type, - String? rank, - String? fxLink, - }) = _Location; +class Location { + String? name; + String? id; + String? lat; + String? lon; + String? adm2; + String? adm1; + String? country; + String? tz; + String? utcOffset; + String? isDst; + String? type; + String? rank; + String? fxLink; - factory Location.fromJson(Map json) => - _$LocationFromJson(json); + Location({ + this.name, + this.id, + this.lat, + this.lon, + this.adm2, + this.adm1, + this.country, + this.tz, + this.utcOffset, + this.isDst, + this.type, + this.rank, + this.fxLink, + }); + + Location.fromJson(Map json) { + name = json["name"]; + id = json["id"]; + lat = json["lat"]; + lon = json["lon"]; + adm2 = json["adm2"]; + adm1 = json["adm1"]; + country = json["country"]; + tz = json["tz"]; + utcOffset = json["utcOffset"]; + isDst = json["isDst"]; + type = json["type"]; + rank = json["rank"]; + fxLink = json["fxLink"]; + } + + Map toJson() { + final Map data = {}; + data["name"] = name; + data["id"] = id; + data["lat"] = lat; + data["lon"] = lon; + data["adm2"] = adm2; + data["adm1"] = adm1; + data["country"] = country; + data["tz"] = tz; + data["utcOffset"] = utcOffset; + data["isDst"] = isDst; + data["type"] = type; + data["rank"] = rank; + data["fxLink"] = fxLink; + return data; + } } diff --git a/lib/common/models/geo.freezed.dart b/lib/common/models/geo.freezed.dart deleted file mode 100644 index 7d25248..0000000 --- a/lib/common/models/geo.freezed.dart +++ /dev/null @@ -1,768 +0,0 @@ -// dart format width=80 -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'geo.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$GeoResponse { - - String? get code; - - List? get location; - - Refer? get refer; - - /// Create a copy of GeoResponse - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $GeoResponseCopyWith get copyWith => - _$GeoResponseCopyWithImpl(this as GeoResponse, _$identity); - - /// Serializes this GeoResponse to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is GeoResponse && - (identical(other.code, code) || other.code == code) && - const DeepCollectionEquality().equals(other.location, location) && - (identical(other.refer, refer) || other.refer == refer)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, code, const DeepCollectionEquality().hash(location), refer); - - @override - String toString() { - return 'GeoResponse(code: $code, location: $location, refer: $refer)'; - } - - -} - -/// @nodoc -abstract mixin class $GeoResponseCopyWith<$Res> { - factory $GeoResponseCopyWith(GeoResponse value, - $Res Function(GeoResponse) _then) = _$GeoResponseCopyWithImpl; - - @useResult - $Res call({ - String? code, List? location, Refer? refer - }); - - - $ReferCopyWith<$Res>? get refer; - -} - -/// @nodoc -class _$GeoResponseCopyWithImpl<$Res> - implements $GeoResponseCopyWith<$Res> { - _$GeoResponseCopyWithImpl(this._self, this._then); - - final GeoResponse _self; - final $Res Function(GeoResponse) _then; - - /// Create a copy of GeoResponse - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? code = freezed, Object? location = freezed, Object? refer = freezed,}) { - return _then(_self.copyWith( - code: freezed == code - ? _self.code - : code // ignore: cast_nullable_to_non_nullable - as String?, - location: freezed == location - ? _self.location - : location // ignore: cast_nullable_to_non_nullable - as List?, - refer: freezed == refer - ? _self.refer - : refer // ignore: cast_nullable_to_non_nullable - as Refer?, - )); - } - - /// Create a copy of GeoResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ReferCopyWith<$Res>? get refer { - if (_self.refer == null) { - return null; - } - - return $ReferCopyWith<$Res>(_self.refer!, (value) { - return _then(_self.copyWith(refer: value)); - }); - } -} - - -/// @nodoc -@JsonSerializable() -class _GeoResponse implements GeoResponse { - const _GeoResponse({this.code, final List? location, this.refer}) - : _location = location; - - factory _GeoResponse.fromJson(Map json) => - _$GeoResponseFromJson(json); - - @override final String? code; - final List? _location; - - @override List? get location { - final value = _location; - if (value == null) return null; - if (_location is EqualUnmodifiableListView) return _location; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override final Refer? refer; - - /// Create a copy of GeoResponse - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$GeoResponseCopyWith<_GeoResponse> get copyWith => - __$GeoResponseCopyWithImpl<_GeoResponse>(this, _$identity); - - @override - Map toJson() { - return _$GeoResponseToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _GeoResponse && - (identical(other.code, code) || other.code == code) && - const DeepCollectionEquality().equals(other._location, _location) && - (identical(other.refer, refer) || other.refer == refer)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, code, const DeepCollectionEquality().hash(_location), refer); - - @override - String toString() { - return 'GeoResponse(code: $code, location: $location, refer: $refer)'; - } - - -} - -/// @nodoc -abstract mixin class _$GeoResponseCopyWith<$Res> - implements $GeoResponseCopyWith<$Res> { - factory _$GeoResponseCopyWith(_GeoResponse value, - $Res Function(_GeoResponse) _then) = __$GeoResponseCopyWithImpl; - - @override - @useResult - $Res call({ - String? code, List? location, Refer? refer - }); - - - @override $ReferCopyWith<$Res>? get refer; - -} - -/// @nodoc -class __$GeoResponseCopyWithImpl<$Res> - implements _$GeoResponseCopyWith<$Res> { - __$GeoResponseCopyWithImpl(this._self, this._then); - - final _GeoResponse _self; - final $Res Function(_GeoResponse) _then; - - /// Create a copy of GeoResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? code = freezed, Object? location = freezed, Object? refer = freezed,}) { - return _then(_GeoResponse( - code: freezed == code - ? _self.code - : code // ignore: cast_nullable_to_non_nullable - as String?, - location: freezed == location - ? _self._location - : location // ignore: cast_nullable_to_non_nullable - as List?, - refer: freezed == refer - ? _self.refer - : refer // ignore: cast_nullable_to_non_nullable - as Refer?, - )); - } - - /// Create a copy of GeoResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ReferCopyWith<$Res>? get refer { - if (_self.refer == null) { - return null; - } - - return $ReferCopyWith<$Res>(_self.refer!, (value) { - return _then(_self.copyWith(refer: value)); - }); - } -} - - -/// @nodoc -mixin _$Refer { - - List? get sources; - - List? get license; - - /// Create a copy of Refer - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $ReferCopyWith get copyWith => - _$ReferCopyWithImpl(this as Refer, _$identity); - - /// Serializes this Refer to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Refer && - const DeepCollectionEquality().equals(other.sources, sources) && - const DeepCollectionEquality().equals(other.license, license)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, const DeepCollectionEquality().hash(sources), - const DeepCollectionEquality().hash(license)); - - @override - String toString() { - return 'Refer(sources: $sources, license: $license)'; - } - - -} - -/// @nodoc -abstract mixin class $ReferCopyWith<$Res> { - factory $ReferCopyWith(Refer value, - $Res Function(Refer) _then) = _$ReferCopyWithImpl; - - @useResult - $Res call({ - List? sources, List? license - }); - - -} - -/// @nodoc -class _$ReferCopyWithImpl<$Res> - implements $ReferCopyWith<$Res> { - _$ReferCopyWithImpl(this._self, this._then); - - final Refer _self; - final $Res Function(Refer) _then; - - /// Create a copy of Refer - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({Object? sources = freezed, Object? license = freezed,}) { - return _then(_self.copyWith( - sources: freezed == sources - ? _self.sources - : sources // ignore: cast_nullable_to_non_nullable - as List?, - license: freezed == license - ? _self.license - : license // ignore: cast_nullable_to_non_nullable - as List?, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _Refer implements Refer { - const _Refer({final List? sources, final List? license}) - : _sources = sources, - _license = license; - - factory _Refer.fromJson(Map json) => _$ReferFromJson(json); - - final List? _sources; - - @override List? get sources { - final value = _sources; - if (value == null) return null; - if (_sources is EqualUnmodifiableListView) return _sources; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _license; - - @override List? get license { - final value = _license; - if (value == null) return null; - if (_license is EqualUnmodifiableListView) return _license; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - - /// Create a copy of Refer - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$ReferCopyWith<_Refer> get copyWith => - __$ReferCopyWithImpl<_Refer>(this, _$identity); - - @override - Map toJson() { - return _$ReferToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Refer && - const DeepCollectionEquality().equals(other._sources, _sources) && - const DeepCollectionEquality().equals(other._license, _license)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, const DeepCollectionEquality().hash(_sources), - const DeepCollectionEquality().hash(_license)); - - @override - String toString() { - return 'Refer(sources: $sources, license: $license)'; - } - - -} - -/// @nodoc -abstract mixin class _$ReferCopyWith<$Res> implements $ReferCopyWith<$Res> { - factory _$ReferCopyWith(_Refer value, - $Res Function(_Refer) _then) = __$ReferCopyWithImpl; - - @override - @useResult - $Res call({ - List? sources, List? license - }); - - -} - -/// @nodoc -class __$ReferCopyWithImpl<$Res> - implements _$ReferCopyWith<$Res> { - __$ReferCopyWithImpl(this._self, this._then); - - final _Refer _self; - final $Res Function(_Refer) _then; - - /// Create a copy of Refer - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({Object? sources = freezed, Object? license = freezed,}) { - return _then(_Refer( - sources: freezed == sources - ? _self._sources - : sources // ignore: cast_nullable_to_non_nullable - as List?, - license: freezed == license - ? _self._license - : license // ignore: cast_nullable_to_non_nullable - as List?, - )); - } - - -} - - -/// @nodoc -mixin _$Location { - - String? get name; - - String? get id; - - String? get lat; - - String? get lon; - - String? get adm2; - - String? get adm1; - - String? get country; - - String? get tz; - - String? get utcOffset; - - String? get isDst; - - String? get type; - - String? get rank; - - String? get fxLink; - - /// Create a copy of Location - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $LocationCopyWith get copyWith => - _$LocationCopyWithImpl(this as Location, _$identity); - - /// Serializes this Location to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Location && - (identical(other.name, name) || other.name == name) && - (identical(other.id, id) || other.id == id) && - (identical(other.lat, lat) || other.lat == lat) && - (identical(other.lon, lon) || other.lon == lon) && - (identical(other.adm2, adm2) || other.adm2 == adm2) && - (identical(other.adm1, adm1) || other.adm1 == adm1) && - (identical(other.country, country) || other.country == country) && - (identical(other.tz, tz) || other.tz == tz) && - (identical(other.utcOffset, utcOffset) || - other.utcOffset == utcOffset) && - (identical(other.isDst, isDst) || other.isDst == isDst) && - (identical(other.type, type) || other.type == type) && - (identical(other.rank, rank) || other.rank == rank) && - (identical(other.fxLink, fxLink) || other.fxLink == fxLink)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, - name, - id, - lat, - lon, - adm2, - adm1, - country, - tz, - utcOffset, - isDst, - type, - rank, - fxLink); - - @override - String toString() { - return 'Location(name: $name, id: $id, lat: $lat, lon: $lon, adm2: $adm2, adm1: $adm1, country: $country, tz: $tz, utcOffset: $utcOffset, isDst: $isDst, type: $type, rank: $rank, fxLink: $fxLink)'; - } - - -} - -/// @nodoc -abstract mixin class $LocationCopyWith<$Res> { - factory $LocationCopyWith(Location value, - $Res Function(Location) _then) = _$LocationCopyWithImpl; - - @useResult - $Res call({ - String? name, String? id, String? lat, String? lon, String? adm2, String? adm1, String? country, String? tz, String? utcOffset, String? isDst, String? type, String? rank, String? fxLink - }); - - -} - -/// @nodoc -class _$LocationCopyWithImpl<$Res> - implements $LocationCopyWith<$Res> { - _$LocationCopyWithImpl(this._self, this._then); - - final Location _self; - final $Res Function(Location) _then; - - /// Create a copy of Location - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? name = freezed, Object? id = freezed, Object? lat = freezed, Object? lon = freezed, Object? adm2 = freezed, Object? adm1 = freezed, Object? country = freezed, Object? tz = freezed, Object? utcOffset = freezed, Object? isDst = freezed, Object? type = freezed, Object? rank = freezed, Object? fxLink = freezed,}) { - return _then(_self.copyWith( - name: freezed == name - ? _self.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as String?, - lat: freezed == lat - ? _self.lat - : lat // ignore: cast_nullable_to_non_nullable - as String?, - lon: freezed == lon - ? _self.lon - : lon // ignore: cast_nullable_to_non_nullable - as String?, - adm2: freezed == adm2 - ? _self.adm2 - : adm2 // ignore: cast_nullable_to_non_nullable - as String?, - adm1: freezed == adm1 - ? _self.adm1 - : adm1 // ignore: cast_nullable_to_non_nullable - as String?, - country: freezed == country - ? _self.country - : country // ignore: cast_nullable_to_non_nullable - as String?, - tz: freezed == tz ? _self.tz : tz // ignore: cast_nullable_to_non_nullable - as String?, - utcOffset: freezed == utcOffset - ? _self.utcOffset - : utcOffset // ignore: cast_nullable_to_non_nullable - as String?, - isDst: freezed == isDst - ? _self.isDst - : isDst // ignore: cast_nullable_to_non_nullable - as String?, - type: freezed == type - ? _self.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - rank: freezed == rank - ? _self.rank - : rank // ignore: cast_nullable_to_non_nullable - as String?, - fxLink: freezed == fxLink - ? _self.fxLink - : fxLink // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _Location implements Location { - const _Location( - {this.name, this.id, this.lat, this.lon, this.adm2, this.adm1, this.country, this.tz, this.utcOffset, this.isDst, this.type, this.rank, this.fxLink}); - - factory _Location.fromJson(Map json) => - _$LocationFromJson(json); - - @override final String? name; - @override final String? id; - @override final String? lat; - @override final String? lon; - @override final String? adm2; - @override final String? adm1; - @override final String? country; - @override final String? tz; - @override final String? utcOffset; - @override final String? isDst; - @override final String? type; - @override final String? rank; - @override final String? fxLink; - - /// Create a copy of Location - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$LocationCopyWith<_Location> get copyWith => - __$LocationCopyWithImpl<_Location>(this, _$identity); - - @override - Map toJson() { - return _$LocationToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Location && - (identical(other.name, name) || other.name == name) && - (identical(other.id, id) || other.id == id) && - (identical(other.lat, lat) || other.lat == lat) && - (identical(other.lon, lon) || other.lon == lon) && - (identical(other.adm2, adm2) || other.adm2 == adm2) && - (identical(other.adm1, adm1) || other.adm1 == adm1) && - (identical(other.country, country) || other.country == country) && - (identical(other.tz, tz) || other.tz == tz) && - (identical(other.utcOffset, utcOffset) || - other.utcOffset == utcOffset) && - (identical(other.isDst, isDst) || other.isDst == isDst) && - (identical(other.type, type) || other.type == type) && - (identical(other.rank, rank) || other.rank == rank) && - (identical(other.fxLink, fxLink) || other.fxLink == fxLink)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, - name, - id, - lat, - lon, - adm2, - adm1, - country, - tz, - utcOffset, - isDst, - type, - rank, - fxLink); - - @override - String toString() { - return 'Location(name: $name, id: $id, lat: $lat, lon: $lon, adm2: $adm2, adm1: $adm1, country: $country, tz: $tz, utcOffset: $utcOffset, isDst: $isDst, type: $type, rank: $rank, fxLink: $fxLink)'; - } - - -} - -/// @nodoc -abstract mixin class _$LocationCopyWith<$Res> - implements $LocationCopyWith<$Res> { - factory _$LocationCopyWith(_Location value, - $Res Function(_Location) _then) = __$LocationCopyWithImpl; - - @override - @useResult - $Res call({ - String? name, String? id, String? lat, String? lon, String? adm2, String? adm1, String? country, String? tz, String? utcOffset, String? isDst, String? type, String? rank, String? fxLink - }); - - -} - -/// @nodoc -class __$LocationCopyWithImpl<$Res> - implements _$LocationCopyWith<$Res> { - __$LocationCopyWithImpl(this._self, this._then); - - final _Location _self; - final $Res Function(_Location) _then; - - /// Create a copy of Location - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? name = freezed, Object? id = freezed, Object? lat = freezed, Object? lon = freezed, Object? adm2 = freezed, Object? adm1 = freezed, Object? country = freezed, Object? tz = freezed, Object? utcOffset = freezed, Object? isDst = freezed, Object? type = freezed, Object? rank = freezed, Object? fxLink = freezed,}) { - return _then(_Location( - name: freezed == name - ? _self.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as String?, - lat: freezed == lat - ? _self.lat - : lat // ignore: cast_nullable_to_non_nullable - as String?, - lon: freezed == lon - ? _self.lon - : lon // ignore: cast_nullable_to_non_nullable - as String?, - adm2: freezed == adm2 - ? _self.adm2 - : adm2 // ignore: cast_nullable_to_non_nullable - as String?, - adm1: freezed == adm1 - ? _self.adm1 - : adm1 // ignore: cast_nullable_to_non_nullable - as String?, - country: freezed == country - ? _self.country - : country // ignore: cast_nullable_to_non_nullable - as String?, - tz: freezed == tz ? _self.tz : tz // ignore: cast_nullable_to_non_nullable - as String?, - utcOffset: freezed == utcOffset - ? _self.utcOffset - : utcOffset // ignore: cast_nullable_to_non_nullable - as String?, - isDst: freezed == isDst - ? _self.isDst - : isDst // ignore: cast_nullable_to_non_nullable - as String?, - type: freezed == type - ? _self.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - rank: freezed == rank - ? _self.rank - : rank // ignore: cast_nullable_to_non_nullable - as String?, - fxLink: freezed == fxLink - ? _self.fxLink - : fxLink // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - - -} - -// dart format on diff --git a/lib/common/models/geo.g.dart b/lib/common/models/geo.g.dart deleted file mode 100644 index d03fb5f..0000000 --- a/lib/common/models/geo.g.dart +++ /dev/null @@ -1,70 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'geo.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_GeoResponse _$GeoResponseFromJson(Map json) => _GeoResponse( - code: json['code'] as String?, - location: - (json['location'] as List?) - ?.map((e) => Location.fromJson(e as Map)) - .toList(), - refer: - json['refer'] == null - ? null - : Refer.fromJson(json['refer'] as Map), -); - -Map _$GeoResponseToJson(_GeoResponse instance) => - { - if (instance.code case final value?) 'code': value, - if (instance.location case final value?) 'location': value, - if (instance.refer case final value?) 'refer': value, - }; - -_Refer _$ReferFromJson(Map json) => _Refer( - sources: - (json['sources'] as List?)?.map((e) => e as String).toList(), - license: - (json['license'] as List?)?.map((e) => e as String).toList(), -); - -Map _$ReferToJson(_Refer instance) => { - if (instance.sources case final value?) 'sources': value, - if (instance.license case final value?) 'license': value, -}; - -_Location _$LocationFromJson(Map json) => _Location( - name: json['name'] as String?, - id: json['id'] as String?, - lat: json['lat'] as String?, - lon: json['lon'] as String?, - adm2: json['adm2'] as String?, - adm1: json['adm1'] as String?, - country: json['country'] as String?, - tz: json['tz'] as String?, - utcOffset: json['utcOffset'] as String?, - isDst: json['isDst'] as String?, - type: json['type'] as String?, - rank: json['rank'] as String?, - fxLink: json['fxLink'] as String?, -); - -Map _$LocationToJson(_Location instance) => { - if (instance.name case final value?) 'name': value, - if (instance.id case final value?) 'id': value, - if (instance.lat case final value?) 'lat': value, - if (instance.lon case final value?) 'lon': value, - if (instance.adm2 case final value?) 'adm2': value, - if (instance.adm1 case final value?) 'adm1': value, - if (instance.country case final value?) 'country': value, - if (instance.tz case final value?) 'tz': value, - if (instance.utcOffset case final value?) 'utcOffset': value, - if (instance.isDst case final value?) 'isDst': value, - if (instance.type case final value?) 'type': value, - if (instance.rank case final value?) 'rank': value, - if (instance.fxLink case final value?) 'fxLink': value, -}; diff --git a/lib/common/models/github.dart b/lib/common/models/github.dart index 7cb58a3..c41fd84 100644 --- a/lib/common/models/github.dart +++ b/lib/common/models/github.dart @@ -1,107 +1,341 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +class GithubRelease { + String? url; + String? assetsUrl; + String? uploadUrl; + String? htmlUrl; + int? id; + Author? author; + String? nodeId; + String? tagName; + String? targetCommitish; + String? name; + bool? draft; + bool? prerelease; + String? createdAt; + String? publishedAt; + List? assets; + String? tarballUrl; + String? zipballUrl; + String? body; -part 'github.freezed.dart'; -part 'github.g.dart'; + GithubRelease({ + this.url, + this.assetsUrl, + this.uploadUrl, + this.htmlUrl, + this.id, + this.author, + this.nodeId, + this.tagName, + this.targetCommitish, + this.name, + this.draft, + this.prerelease, + this.createdAt, + this.publishedAt, + this.assets, + this.tarballUrl, + this.zipballUrl, + this.body, + }); -@freezed -abstract class GithubRelease with _$GithubRelease { - const factory GithubRelease({ - String? url, - @JsonKey(name: 'assets_url') String? assetsUrl, - @JsonKey(name: 'upload_url') String? uploadUrl, - @JsonKey(name: 'html_url') String? htmlUrl, - int? id, - Author? author, - @JsonKey(name: 'node_id') String? nodeId, - @JsonKey(name: 'tag_name') String? tagName, - @JsonKey(name: 'target_commitish') String? targetCommitish, - String? name, - bool? draft, - bool? prerelease, - @JsonKey(name: 'created_at') String? createdAt, - @JsonKey(name: 'published_at') String? publishedAt, - List? assets, - @JsonKey(name: 'tarball_url') String? tarballUrl, - @JsonKey(name: 'zipball_url') String? zipballUrl, - String? body, - }) = _GithubRelease; + GithubRelease.fromJson(Map json) { + url = json["url"]; + assetsUrl = json["assets_url"]; + uploadUrl = json["upload_url"]; + htmlUrl = json["html_url"]; + id = json["id"]; + author = json["author"] == null ? null : Author.fromJson(json["author"]); + nodeId = json["node_id"]; + tagName = json["tag_name"]; + targetCommitish = json["target_commitish"]; + name = json["name"]; + draft = json["draft"]; + prerelease = json["prerelease"]; + createdAt = json["created_at"]; + publishedAt = json["published_at"]; + assets = + json["assets"] == null + ? null + : (json["assets"] as List).map((e) => Assets.fromJson(e)).toList(); + tarballUrl = json["tarball_url"]; + zipballUrl = json["zipball_url"]; + body = json["body"]; + } - factory GithubRelease.fromJson(Map json) => - _$GithubReleaseFromJson(json); + Map toJson() { + final Map data = {}; + data["url"] = url; + data["assets_url"] = assetsUrl; + data["upload_url"] = uploadUrl; + data["html_url"] = htmlUrl; + data["id"] = id; + if (author != null) { + data["author"] = author?.toJson(); + } + data["node_id"] = nodeId; + data["tag_name"] = tagName; + data["target_commitish"] = targetCommitish; + data["name"] = name; + data["draft"] = draft; + data["prerelease"] = prerelease; + data["created_at"] = createdAt; + data["published_at"] = publishedAt; + if (assets != null) { + data["assets"] = assets?.map((e) => e.toJson()).toList(); + } + data["tarball_url"] = tarballUrl; + data["zipball_url"] = zipballUrl; + data["body"] = body; + return data; + } } -@freezed -abstract class Assets with _$Assets { - const factory Assets({ - String? url, - int? id, - @JsonKey(name: 'node_id') String? nodeId, - String? name, - dynamic label, - Uploader? uploader, - @JsonKey(name: 'content_type') String? contentType, - String? state, - int? size, - @JsonKey(name: 'download_count') int? downloadCount, - @JsonKey(name: 'created_at') String? createdAt, - @JsonKey(name: 'updated_at') String? updatedAt, - @JsonKey(name: 'browser_download_url') String? browserDownloadUrl, - }) = _Assets; +class Assets { + String? url; + int? id; + String? nodeId; + String? name; + dynamic label; + Uploader? uploader; + String? contentType; + String? state; + int? size; + int? downloadCount; + String? createdAt; + String? updatedAt; + String? browserDownloadUrl; - factory Assets.fromJson(Map json) => _$AssetsFromJson(json); + Assets({ + this.url, + this.id, + this.nodeId, + this.name, + this.label, + this.uploader, + this.contentType, + this.state, + this.size, + this.downloadCount, + this.createdAt, + this.updatedAt, + this.browserDownloadUrl, + }); + + Assets.fromJson(Map json) { + url = json["url"]; + id = json["id"]; + nodeId = json["node_id"]; + name = json["name"]; + label = json["label"]; + uploader = + json["uploader"] == null ? null : Uploader.fromJson(json["uploader"]); + contentType = json["content_type"]; + state = json["state"]; + size = json["size"]; + downloadCount = json["download_count"]; + createdAt = json["created_at"]; + updatedAt = json["updated_at"]; + browserDownloadUrl = json["browser_download_url"]; + } + + Map toJson() { + final Map data = {}; + data["url"] = url; + data["id"] = id; + data["node_id"] = nodeId; + data["name"] = name; + data["label"] = label; + if (uploader != null) { + data["uploader"] = uploader?.toJson(); + } + data["content_type"] = contentType; + data["state"] = state; + data["size"] = size; + data["download_count"] = downloadCount; + data["created_at"] = createdAt; + data["updated_at"] = updatedAt; + data["browser_download_url"] = browserDownloadUrl; + return data; + } } -@freezed -abstract class Uploader with _$Uploader { - const factory Uploader({ - String? login, - int? id, - @JsonKey(name: 'node_id') String? nodeId, - @JsonKey(name: 'avatar_url') String? avatarUrl, - @JsonKey(name: 'gravatar_id') String? gravatarId, - String? url, - @JsonKey(name: 'html_url') String? htmlUrl, - @JsonKey(name: 'followers_url') String? followersUrl, - @JsonKey(name: 'following_url') String? followingUrl, - @JsonKey(name: 'gists_url') String? gistsUrl, - @JsonKey(name: 'starred_url') String? starredUrl, - @JsonKey(name: 'subscriptions_url') String? subscriptionsUrl, - @JsonKey(name: 'organizations_url') String? organizationsUrl, - @JsonKey(name: 'repos_url') String? reposUrl, - @JsonKey(name: 'events_url') String? eventsUrl, - @JsonKey(name: 'received_events_url') String? receivedEventsUrl, - String? type, - @JsonKey(name: 'user_view_type') String? userViewType, - @JsonKey(name: 'site_admin') bool? siteAdmin, - }) = _Uploader; +class Uploader { + String? login; + int? id; + String? nodeId; + String? avatarUrl; + String? gravatarId; + String? url; + String? htmlUrl; + String? followersUrl; + String? followingUrl; + String? gistsUrl; + String? starredUrl; + String? subscriptionsUrl; + String? organizationsUrl; + String? reposUrl; + String? eventsUrl; + String? receivedEventsUrl; + String? type; + String? userViewType; + bool? siteAdmin; - factory Uploader.fromJson(Map json) => - _$UploaderFromJson(json); + Uploader({ + this.login, + this.id, + this.nodeId, + this.avatarUrl, + this.gravatarId, + this.url, + this.htmlUrl, + this.followersUrl, + this.followingUrl, + this.gistsUrl, + this.starredUrl, + this.subscriptionsUrl, + this.organizationsUrl, + this.reposUrl, + this.eventsUrl, + this.receivedEventsUrl, + this.type, + this.userViewType, + this.siteAdmin, + }); + + Uploader.fromJson(Map json) { + login = json["login"]; + id = json["id"]; + nodeId = json["node_id"]; + avatarUrl = json["avatar_url"]; + gravatarId = json["gravatar_id"]; + url = json["url"]; + htmlUrl = json["html_url"]; + followersUrl = json["followers_url"]; + followingUrl = json["following_url"]; + gistsUrl = json["gists_url"]; + starredUrl = json["starred_url"]; + subscriptionsUrl = json["subscriptions_url"]; + organizationsUrl = json["organizations_url"]; + reposUrl = json["repos_url"]; + eventsUrl = json["events_url"]; + receivedEventsUrl = json["received_events_url"]; + type = json["type"]; + userViewType = json["user_view_type"]; + siteAdmin = json["site_admin"]; + } + + Map toJson() { + final Map data = {}; + data["login"] = login; + data["id"] = id; + data["node_id"] = nodeId; + data["avatar_url"] = avatarUrl; + data["gravatar_id"] = gravatarId; + data["url"] = url; + data["html_url"] = htmlUrl; + data["followers_url"] = followersUrl; + data["following_url"] = followingUrl; + data["gists_url"] = gistsUrl; + data["starred_url"] = starredUrl; + data["subscriptions_url"] = subscriptionsUrl; + data["organizations_url"] = organizationsUrl; + data["repos_url"] = reposUrl; + data["events_url"] = eventsUrl; + data["received_events_url"] = receivedEventsUrl; + data["type"] = type; + data["user_view_type"] = userViewType; + data["site_admin"] = siteAdmin; + return data; + } } -@freezed -abstract class Author with _$Author { - const factory Author({ - String? login, - int? id, - @JsonKey(name: 'node_id') String? nodeId, - @JsonKey(name: 'avatar_url') String? avatarUrl, - @JsonKey(name: 'gravatar_id') String? gravatarId, - String? url, - @JsonKey(name: 'html_url') String? htmlUrl, - @JsonKey(name: 'followers_url') String? followersUrl, - @JsonKey(name: 'following_url') String? followingUrl, - @JsonKey(name: 'gists_url') String? gistsUrl, - @JsonKey(name: 'starred_url') String? starredUrl, - @JsonKey(name: 'subscriptions_url') String? subscriptionsUrl, - @JsonKey(name: 'organizations_url') String? organizationsUrl, - @JsonKey(name: 'repos_url') String? reposUrl, - @JsonKey(name: 'events_url') String? eventsUrl, - @JsonKey(name: 'received_events_url') String? receivedEventsUrl, - String? type, - @JsonKey(name: 'user_view_type') String? userViewType, - @JsonKey(name: 'site_admin') bool? siteAdmin, - }) = _Author; +class Author { + String? login; + int? id; + String? nodeId; + String? avatarUrl; + String? gravatarId; + String? url; + String? htmlUrl; + String? followersUrl; + String? followingUrl; + String? gistsUrl; + String? starredUrl; + String? subscriptionsUrl; + String? organizationsUrl; + String? reposUrl; + String? eventsUrl; + String? receivedEventsUrl; + String? type; + String? userViewType; + bool? siteAdmin; - factory Author.fromJson(Map json) => _$AuthorFromJson(json); + Author({ + this.login, + this.id, + this.nodeId, + this.avatarUrl, + this.gravatarId, + this.url, + this.htmlUrl, + this.followersUrl, + this.followingUrl, + this.gistsUrl, + this.starredUrl, + this.subscriptionsUrl, + this.organizationsUrl, + this.reposUrl, + this.eventsUrl, + this.receivedEventsUrl, + this.type, + this.userViewType, + this.siteAdmin, + }); + + Author.fromJson(Map json) { + login = json["login"]; + id = json["id"]; + nodeId = json["node_id"]; + avatarUrl = json["avatar_url"]; + gravatarId = json["gravatar_id"]; + url = json["url"]; + htmlUrl = json["html_url"]; + followersUrl = json["followers_url"]; + followingUrl = json["following_url"]; + gistsUrl = json["gists_url"]; + starredUrl = json["starred_url"]; + subscriptionsUrl = json["subscriptions_url"]; + organizationsUrl = json["organizations_url"]; + reposUrl = json["repos_url"]; + eventsUrl = json["events_url"]; + receivedEventsUrl = json["received_events_url"]; + type = json["type"]; + userViewType = json["user_view_type"]; + siteAdmin = json["site_admin"]; + } + + Map toJson() { + final Map data = {}; + data["login"] = login; + data["id"] = id; + data["node_id"] = nodeId; + data["avatar_url"] = avatarUrl; + data["gravatar_id"] = gravatarId; + data["url"] = url; + data["html_url"] = htmlUrl; + data["followers_url"] = followersUrl; + data["following_url"] = followingUrl; + data["gists_url"] = gistsUrl; + data["starred_url"] = starredUrl; + data["subscriptions_url"] = subscriptionsUrl; + data["organizations_url"] = organizationsUrl; + data["repos_url"] = reposUrl; + data["events_url"] = eventsUrl; + data["received_events_url"] = receivedEventsUrl; + data["type"] = type; + data["user_view_type"] = userViewType; + data["site_admin"] = siteAdmin; + return data; + } } diff --git a/lib/common/models/github.freezed.dart b/lib/common/models/github.freezed.dart deleted file mode 100644 index e48e692..0000000 --- a/lib/common/models/github.freezed.dart +++ /dev/null @@ -1,1997 +0,0 @@ -// dart format width=80 -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'github.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$GithubRelease { - - String? get url; - - @JsonKey(name: 'assets_url') String? get assetsUrl; - - @JsonKey(name: 'upload_url') String? get uploadUrl; - - @JsonKey(name: 'html_url') String? get htmlUrl; - - int? get id; - - Author? get author; - - @JsonKey(name: 'node_id') String? get nodeId; - - @JsonKey(name: 'tag_name') String? get tagName; - - @JsonKey(name: 'target_commitish') String? get targetCommitish; - - String? get name; - - bool? get draft; - - bool? get prerelease; - - @JsonKey(name: 'created_at') String? get createdAt; - - @JsonKey(name: 'published_at') String? get publishedAt; - - List? get assets; - - @JsonKey(name: 'tarball_url') String? get tarballUrl; - - @JsonKey(name: 'zipball_url') String? get zipballUrl; - - String? get body; - - /// Create a copy of GithubRelease - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $GithubReleaseCopyWith get copyWith => - _$GithubReleaseCopyWithImpl( - this as GithubRelease, _$identity); - - /// Serializes this GithubRelease to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is GithubRelease && - (identical(other.url, url) || other.url == url) && - (identical(other.assetsUrl, assetsUrl) || - other.assetsUrl == assetsUrl) && - (identical(other.uploadUrl, uploadUrl) || - other.uploadUrl == uploadUrl) && - (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && - (identical(other.id, id) || other.id == id) && - (identical(other.author, author) || other.author == author) && - (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && - (identical(other.tagName, tagName) || other.tagName == tagName) && - (identical(other.targetCommitish, targetCommitish) || - other.targetCommitish == targetCommitish) && - (identical(other.name, name) || other.name == name) && - (identical(other.draft, draft) || other.draft == draft) && - (identical(other.prerelease, prerelease) || - other.prerelease == prerelease) && - (identical(other.createdAt, createdAt) || - other.createdAt == createdAt) && - (identical(other.publishedAt, publishedAt) || - other.publishedAt == publishedAt) && - const DeepCollectionEquality().equals(other.assets, assets) && - (identical(other.tarballUrl, tarballUrl) || - other.tarballUrl == tarballUrl) && - (identical(other.zipballUrl, zipballUrl) || - other.zipballUrl == zipballUrl) && - (identical(other.body, body) || other.body == body)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, - url, - assetsUrl, - uploadUrl, - htmlUrl, - id, - author, - nodeId, - tagName, - targetCommitish, - name, - draft, - prerelease, - createdAt, - publishedAt, - const DeepCollectionEquality().hash(assets), - tarballUrl, - zipballUrl, - body); - - @override - String toString() { - return 'GithubRelease(url: $url, assetsUrl: $assetsUrl, uploadUrl: $uploadUrl, htmlUrl: $htmlUrl, id: $id, author: $author, nodeId: $nodeId, tagName: $tagName, targetCommitish: $targetCommitish, name: $name, draft: $draft, prerelease: $prerelease, createdAt: $createdAt, publishedAt: $publishedAt, assets: $assets, tarballUrl: $tarballUrl, zipballUrl: $zipballUrl, body: $body)'; - } - - -} - -/// @nodoc -abstract mixin class $GithubReleaseCopyWith<$Res> { - factory $GithubReleaseCopyWith(GithubRelease value, - $Res Function(GithubRelease) _then) = _$GithubReleaseCopyWithImpl; - - @useResult - $Res call({ - String? url, @JsonKey(name: 'assets_url') String? assetsUrl, @JsonKey( - name: 'upload_url') String? uploadUrl, @JsonKey( - name: 'html_url') String? htmlUrl, int? id, Author? author, @JsonKey( - name: 'node_id') String? nodeId, @JsonKey( - name: 'tag_name') String? tagName, @JsonKey( - name: 'target_commitish') String? targetCommitish, String? name, bool? draft, bool? prerelease, @JsonKey( - name: 'created_at') String? createdAt, @JsonKey( - name: 'published_at') String? publishedAt, List< - Assets>? assets, @JsonKey( - name: 'tarball_url') String? tarballUrl, @JsonKey( - name: 'zipball_url') String? zipballUrl, String? body - }); - - - $AuthorCopyWith<$Res>? get author; - -} - -/// @nodoc -class _$GithubReleaseCopyWithImpl<$Res> - implements $GithubReleaseCopyWith<$Res> { - _$GithubReleaseCopyWithImpl(this._self, this._then); - - final GithubRelease _self; - final $Res Function(GithubRelease) _then; - - /// Create a copy of GithubRelease - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? url = freezed, Object? assetsUrl = freezed, Object? uploadUrl = freezed, Object? htmlUrl = freezed, Object? id = freezed, Object? author = freezed, Object? nodeId = freezed, Object? tagName = freezed, Object? targetCommitish = freezed, Object? name = freezed, Object? draft = freezed, Object? prerelease = freezed, Object? createdAt = freezed, Object? publishedAt = freezed, Object? assets = freezed, Object? tarballUrl = freezed, Object? zipballUrl = freezed, Object? body = freezed,}) { - return _then(_self.copyWith( - url: freezed == url - ? _self.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - assetsUrl: freezed == assetsUrl - ? _self.assetsUrl - : assetsUrl // ignore: cast_nullable_to_non_nullable - as String?, - uploadUrl: freezed == uploadUrl - ? _self.uploadUrl - : uploadUrl // ignore: cast_nullable_to_non_nullable - as String?, - htmlUrl: freezed == htmlUrl - ? _self.htmlUrl - : htmlUrl // ignore: cast_nullable_to_non_nullable - as String?, - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as int?, - author: freezed == author - ? _self.author - : author // ignore: cast_nullable_to_non_nullable - as Author?, - nodeId: freezed == nodeId - ? _self.nodeId - : nodeId // ignore: cast_nullable_to_non_nullable - as String?, - tagName: freezed == tagName - ? _self.tagName - : tagName // ignore: cast_nullable_to_non_nullable - as String?, - targetCommitish: freezed == targetCommitish - ? _self.targetCommitish - : targetCommitish // ignore: cast_nullable_to_non_nullable - as String?, - name: freezed == name - ? _self.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - draft: freezed == draft - ? _self.draft - : draft // ignore: cast_nullable_to_non_nullable - as bool?, - prerelease: freezed == prerelease - ? _self.prerelease - : prerelease // ignore: cast_nullable_to_non_nullable - as bool?, - createdAt: freezed == createdAt - ? _self.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as String?, - publishedAt: freezed == publishedAt - ? _self.publishedAt - : publishedAt // ignore: cast_nullable_to_non_nullable - as String?, - assets: freezed == assets - ? _self.assets - : assets // ignore: cast_nullable_to_non_nullable - as List?, - tarballUrl: freezed == tarballUrl - ? _self.tarballUrl - : tarballUrl // ignore: cast_nullable_to_non_nullable - as String?, - zipballUrl: freezed == zipballUrl - ? _self.zipballUrl - : zipballUrl // ignore: cast_nullable_to_non_nullable - as String?, - body: freezed == body - ? _self.body - : body // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - - /// Create a copy of GithubRelease - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $AuthorCopyWith<$Res>? get author { - if (_self.author == null) { - return null; - } - - return $AuthorCopyWith<$Res>(_self.author!, (value) { - return _then(_self.copyWith(author: value)); - }); - } -} - - -/// @nodoc -@JsonSerializable() -class _GithubRelease implements GithubRelease { - const _GithubRelease( - {this.url, @JsonKey(name: 'assets_url') this.assetsUrl, @JsonKey( - name: 'upload_url') this.uploadUrl, @JsonKey( - name: 'html_url') this.htmlUrl, this.id, this.author, @JsonKey( - name: 'node_id') this.nodeId, @JsonKey( - name: 'tag_name') this.tagName, @JsonKey( - name: 'target_commitish') this.targetCommitish, this.name, this.draft, this.prerelease, @JsonKey( - name: 'created_at') this.createdAt, @JsonKey( - name: 'published_at') this.publishedAt, final List< - Assets>? assets, @JsonKey( - name: 'tarball_url') this.tarballUrl, @JsonKey( - name: 'zipball_url') this.zipballUrl, this.body}) : _assets = assets; - - factory _GithubRelease.fromJson(Map json) => - _$GithubReleaseFromJson(json); - - @override final String? url; - @override - @JsonKey(name: 'assets_url') - final String? assetsUrl; - @override - @JsonKey(name: 'upload_url') - final String? uploadUrl; - @override - @JsonKey(name: 'html_url') - final String? htmlUrl; - @override final int? id; - @override final Author? author; - @override - @JsonKey(name: 'node_id') - final String? nodeId; - @override - @JsonKey(name: 'tag_name') - final String? tagName; - @override - @JsonKey(name: 'target_commitish') - final String? targetCommitish; - @override final String? name; - @override final bool? draft; - @override final bool? prerelease; - @override - @JsonKey(name: 'created_at') - final String? createdAt; - @override - @JsonKey(name: 'published_at') - final String? publishedAt; - final List? _assets; - - @override List? get assets { - final value = _assets; - if (value == null) return null; - if (_assets is EqualUnmodifiableListView) return _assets; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - @JsonKey(name: 'tarball_url') - final String? tarballUrl; - @override - @JsonKey(name: 'zipball_url') - final String? zipballUrl; - @override final String? body; - - /// Create a copy of GithubRelease - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$GithubReleaseCopyWith<_GithubRelease> get copyWith => - __$GithubReleaseCopyWithImpl<_GithubRelease>(this, _$identity); - - @override - Map toJson() { - return _$GithubReleaseToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _GithubRelease && - (identical(other.url, url) || other.url == url) && - (identical(other.assetsUrl, assetsUrl) || - other.assetsUrl == assetsUrl) && - (identical(other.uploadUrl, uploadUrl) || - other.uploadUrl == uploadUrl) && - (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && - (identical(other.id, id) || other.id == id) && - (identical(other.author, author) || other.author == author) && - (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && - (identical(other.tagName, tagName) || other.tagName == tagName) && - (identical(other.targetCommitish, targetCommitish) || - other.targetCommitish == targetCommitish) && - (identical(other.name, name) || other.name == name) && - (identical(other.draft, draft) || other.draft == draft) && - (identical(other.prerelease, prerelease) || - other.prerelease == prerelease) && - (identical(other.createdAt, createdAt) || - other.createdAt == createdAt) && - (identical(other.publishedAt, publishedAt) || - other.publishedAt == publishedAt) && - const DeepCollectionEquality().equals(other._assets, _assets) && - (identical(other.tarballUrl, tarballUrl) || - other.tarballUrl == tarballUrl) && - (identical(other.zipballUrl, zipballUrl) || - other.zipballUrl == zipballUrl) && - (identical(other.body, body) || other.body == body)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, - url, - assetsUrl, - uploadUrl, - htmlUrl, - id, - author, - nodeId, - tagName, - targetCommitish, - name, - draft, - prerelease, - createdAt, - publishedAt, - const DeepCollectionEquality().hash(_assets), - tarballUrl, - zipballUrl, - body); - - @override - String toString() { - return 'GithubRelease(url: $url, assetsUrl: $assetsUrl, uploadUrl: $uploadUrl, htmlUrl: $htmlUrl, id: $id, author: $author, nodeId: $nodeId, tagName: $tagName, targetCommitish: $targetCommitish, name: $name, draft: $draft, prerelease: $prerelease, createdAt: $createdAt, publishedAt: $publishedAt, assets: $assets, tarballUrl: $tarballUrl, zipballUrl: $zipballUrl, body: $body)'; - } - - -} - -/// @nodoc -abstract mixin class _$GithubReleaseCopyWith<$Res> - implements $GithubReleaseCopyWith<$Res> { - factory _$GithubReleaseCopyWith(_GithubRelease value, - $Res Function(_GithubRelease) _then) = __$GithubReleaseCopyWithImpl; - - @override - @useResult - $Res call({ - String? url, @JsonKey(name: 'assets_url') String? assetsUrl, @JsonKey( - name: 'upload_url') String? uploadUrl, @JsonKey( - name: 'html_url') String? htmlUrl, int? id, Author? author, @JsonKey( - name: 'node_id') String? nodeId, @JsonKey( - name: 'tag_name') String? tagName, @JsonKey( - name: 'target_commitish') String? targetCommitish, String? name, bool? draft, bool? prerelease, @JsonKey( - name: 'created_at') String? createdAt, @JsonKey( - name: 'published_at') String? publishedAt, List< - Assets>? assets, @JsonKey( - name: 'tarball_url') String? tarballUrl, @JsonKey( - name: 'zipball_url') String? zipballUrl, String? body - }); - - - @override $AuthorCopyWith<$Res>? get author; - -} - -/// @nodoc -class __$GithubReleaseCopyWithImpl<$Res> - implements _$GithubReleaseCopyWith<$Res> { - __$GithubReleaseCopyWithImpl(this._self, this._then); - - final _GithubRelease _self; - final $Res Function(_GithubRelease) _then; - - /// Create a copy of GithubRelease - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? url = freezed, Object? assetsUrl = freezed, Object? uploadUrl = freezed, Object? htmlUrl = freezed, Object? id = freezed, Object? author = freezed, Object? nodeId = freezed, Object? tagName = freezed, Object? targetCommitish = freezed, Object? name = freezed, Object? draft = freezed, Object? prerelease = freezed, Object? createdAt = freezed, Object? publishedAt = freezed, Object? assets = freezed, Object? tarballUrl = freezed, Object? zipballUrl = freezed, Object? body = freezed,}) { - return _then(_GithubRelease( - url: freezed == url - ? _self.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - assetsUrl: freezed == assetsUrl - ? _self.assetsUrl - : assetsUrl // ignore: cast_nullable_to_non_nullable - as String?, - uploadUrl: freezed == uploadUrl - ? _self.uploadUrl - : uploadUrl // ignore: cast_nullable_to_non_nullable - as String?, - htmlUrl: freezed == htmlUrl - ? _self.htmlUrl - : htmlUrl // ignore: cast_nullable_to_non_nullable - as String?, - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as int?, - author: freezed == author - ? _self.author - : author // ignore: cast_nullable_to_non_nullable - as Author?, - nodeId: freezed == nodeId - ? _self.nodeId - : nodeId // ignore: cast_nullable_to_non_nullable - as String?, - tagName: freezed == tagName - ? _self.tagName - : tagName // ignore: cast_nullable_to_non_nullable - as String?, - targetCommitish: freezed == targetCommitish - ? _self.targetCommitish - : targetCommitish // ignore: cast_nullable_to_non_nullable - as String?, - name: freezed == name - ? _self.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - draft: freezed == draft - ? _self.draft - : draft // ignore: cast_nullable_to_non_nullable - as bool?, - prerelease: freezed == prerelease - ? _self.prerelease - : prerelease // ignore: cast_nullable_to_non_nullable - as bool?, - createdAt: freezed == createdAt - ? _self.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as String?, - publishedAt: freezed == publishedAt - ? _self.publishedAt - : publishedAt // ignore: cast_nullable_to_non_nullable - as String?, - assets: freezed == assets - ? _self._assets - : assets // ignore: cast_nullable_to_non_nullable - as List?, - tarballUrl: freezed == tarballUrl - ? _self.tarballUrl - : tarballUrl // ignore: cast_nullable_to_non_nullable - as String?, - zipballUrl: freezed == zipballUrl - ? _self.zipballUrl - : zipballUrl // ignore: cast_nullable_to_non_nullable - as String?, - body: freezed == body - ? _self.body - : body // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - - /// Create a copy of GithubRelease - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $AuthorCopyWith<$Res>? get author { - if (_self.author == null) { - return null; - } - - return $AuthorCopyWith<$Res>(_self.author!, (value) { - return _then(_self.copyWith(author: value)); - }); - } -} - - -/// @nodoc -mixin _$Assets { - - String? get url; - - int? get id; - - @JsonKey(name: 'node_id') String? get nodeId; - - String? get name; - - dynamic get label; - - Uploader? get uploader; - - @JsonKey(name: 'content_type') String? get contentType; - - String? get state; - - int? get size; - - @JsonKey(name: 'download_count') int? get downloadCount; - - @JsonKey(name: 'created_at') String? get createdAt; - - @JsonKey(name: 'updated_at') String? get updatedAt; - - @JsonKey(name: 'browser_download_url') String? get browserDownloadUrl; - - /// Create a copy of Assets - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $AssetsCopyWith get copyWith => - _$AssetsCopyWithImpl(this as Assets, _$identity); - - /// Serializes this Assets to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Assets && - (identical(other.url, url) || other.url == url) && - (identical(other.id, id) || other.id == id) && - (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && - (identical(other.name, name) || other.name == name) && - const DeepCollectionEquality().equals(other.label, label) && - (identical(other.uploader, uploader) || - other.uploader == uploader) && - (identical(other.contentType, contentType) || - other.contentType == contentType) && - (identical(other.state, state) || other.state == state) && - (identical(other.size, size) || other.size == size) && - (identical(other.downloadCount, downloadCount) || - other.downloadCount == downloadCount) && - (identical(other.createdAt, createdAt) || - other.createdAt == createdAt) && - (identical(other.updatedAt, updatedAt) || - other.updatedAt == updatedAt) && - (identical(other.browserDownloadUrl, browserDownloadUrl) || - other.browserDownloadUrl == browserDownloadUrl)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, - url, - id, - nodeId, - name, - const DeepCollectionEquality().hash(label), - uploader, - contentType, - state, - size, - downloadCount, - createdAt, - updatedAt, - browserDownloadUrl); - - @override - String toString() { - return 'Assets(url: $url, id: $id, nodeId: $nodeId, name: $name, label: $label, uploader: $uploader, contentType: $contentType, state: $state, size: $size, downloadCount: $downloadCount, createdAt: $createdAt, updatedAt: $updatedAt, browserDownloadUrl: $browserDownloadUrl)'; - } - - -} - -/// @nodoc -abstract mixin class $AssetsCopyWith<$Res> { - factory $AssetsCopyWith(Assets value, - $Res Function(Assets) _then) = _$AssetsCopyWithImpl; - - @useResult - $Res call({ - String? url, int? id, @JsonKey( - name: 'node_id') String? nodeId, String? name, dynamic label, Uploader? uploader, @JsonKey( - name: 'content_type') String? contentType, String? state, int? size, @JsonKey( - name: 'download_count') int? downloadCount, @JsonKey( - name: 'created_at') String? createdAt, @JsonKey( - name: 'updated_at') String? updatedAt, @JsonKey( - name: 'browser_download_url') String? browserDownloadUrl - }); - - - $UploaderCopyWith<$Res>? get uploader; - -} - -/// @nodoc -class _$AssetsCopyWithImpl<$Res> - implements $AssetsCopyWith<$Res> { - _$AssetsCopyWithImpl(this._self, this._then); - - final Assets _self; - final $Res Function(Assets) _then; - - /// Create a copy of Assets - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? url = freezed, Object? id = freezed, Object? nodeId = freezed, Object? name = freezed, Object? label = freezed, Object? uploader = freezed, Object? contentType = freezed, Object? state = freezed, Object? size = freezed, Object? downloadCount = freezed, Object? createdAt = freezed, Object? updatedAt = freezed, Object? browserDownloadUrl = freezed,}) { - return _then(_self.copyWith( - url: freezed == url - ? _self.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as int?, - nodeId: freezed == nodeId - ? _self.nodeId - : nodeId // ignore: cast_nullable_to_non_nullable - as String?, - name: freezed == name - ? _self.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - label: freezed == label - ? _self.label - : label // ignore: cast_nullable_to_non_nullable - as dynamic, - uploader: freezed == uploader - ? _self.uploader - : uploader // ignore: cast_nullable_to_non_nullable - as Uploader?, - contentType: freezed == contentType - ? _self.contentType - : contentType // ignore: cast_nullable_to_non_nullable - as String?, - state: freezed == state - ? _self.state - : state // ignore: cast_nullable_to_non_nullable - as String?, - size: freezed == size - ? _self.size - : size // ignore: cast_nullable_to_non_nullable - as int?, - downloadCount: freezed == downloadCount - ? _self.downloadCount - : downloadCount // ignore: cast_nullable_to_non_nullable - as int?, - createdAt: freezed == createdAt - ? _self.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as String?, - updatedAt: freezed == updatedAt - ? _self.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as String?, - browserDownloadUrl: freezed == browserDownloadUrl - ? _self.browserDownloadUrl - : browserDownloadUrl // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - - /// Create a copy of Assets - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $UploaderCopyWith<$Res>? get uploader { - if (_self.uploader == null) { - return null; - } - - return $UploaderCopyWith<$Res>(_self.uploader!, (value) { - return _then(_self.copyWith(uploader: value)); - }); - } -} - - -/// @nodoc -@JsonSerializable() -class _Assets implements Assets { - const _Assets({this.url, this.id, @JsonKey( - name: 'node_id') this.nodeId, this.name, this.label, this.uploader, @JsonKey( - name: 'content_type') this.contentType, this.state, this.size, @JsonKey( - name: 'download_count') this.downloadCount, @JsonKey( - name: 'created_at') this.createdAt, @JsonKey( - name: 'updated_at') this.updatedAt, @JsonKey( - name: 'browser_download_url') this.browserDownloadUrl}); - - factory _Assets.fromJson(Map json) => _$AssetsFromJson(json); - - @override final String? url; - @override final int? id; - @override - @JsonKey(name: 'node_id') - final String? nodeId; - @override final String? name; - @override final dynamic label; - @override final Uploader? uploader; - @override - @JsonKey(name: 'content_type') - final String? contentType; - @override final String? state; - @override final int? size; - @override - @JsonKey(name: 'download_count') - final int? downloadCount; - @override - @JsonKey(name: 'created_at') - final String? createdAt; - @override - @JsonKey(name: 'updated_at') - final String? updatedAt; - @override - @JsonKey(name: 'browser_download_url') - final String? browserDownloadUrl; - - /// Create a copy of Assets - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$AssetsCopyWith<_Assets> get copyWith => - __$AssetsCopyWithImpl<_Assets>(this, _$identity); - - @override - Map toJson() { - return _$AssetsToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Assets && - (identical(other.url, url) || other.url == url) && - (identical(other.id, id) || other.id == id) && - (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && - (identical(other.name, name) || other.name == name) && - const DeepCollectionEquality().equals(other.label, label) && - (identical(other.uploader, uploader) || - other.uploader == uploader) && - (identical(other.contentType, contentType) || - other.contentType == contentType) && - (identical(other.state, state) || other.state == state) && - (identical(other.size, size) || other.size == size) && - (identical(other.downloadCount, downloadCount) || - other.downloadCount == downloadCount) && - (identical(other.createdAt, createdAt) || - other.createdAt == createdAt) && - (identical(other.updatedAt, updatedAt) || - other.updatedAt == updatedAt) && - (identical(other.browserDownloadUrl, browserDownloadUrl) || - other.browserDownloadUrl == browserDownloadUrl)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, - url, - id, - nodeId, - name, - const DeepCollectionEquality().hash(label), - uploader, - contentType, - state, - size, - downloadCount, - createdAt, - updatedAt, - browserDownloadUrl); - - @override - String toString() { - return 'Assets(url: $url, id: $id, nodeId: $nodeId, name: $name, label: $label, uploader: $uploader, contentType: $contentType, state: $state, size: $size, downloadCount: $downloadCount, createdAt: $createdAt, updatedAt: $updatedAt, browserDownloadUrl: $browserDownloadUrl)'; - } - - -} - -/// @nodoc -abstract mixin class _$AssetsCopyWith<$Res> implements $AssetsCopyWith<$Res> { - factory _$AssetsCopyWith(_Assets value, - $Res Function(_Assets) _then) = __$AssetsCopyWithImpl; - - @override - @useResult - $Res call({ - String? url, int? id, @JsonKey( - name: 'node_id') String? nodeId, String? name, dynamic label, Uploader? uploader, @JsonKey( - name: 'content_type') String? contentType, String? state, int? size, @JsonKey( - name: 'download_count') int? downloadCount, @JsonKey( - name: 'created_at') String? createdAt, @JsonKey( - name: 'updated_at') String? updatedAt, @JsonKey( - name: 'browser_download_url') String? browserDownloadUrl - }); - - - @override $UploaderCopyWith<$Res>? get uploader; - -} - -/// @nodoc -class __$AssetsCopyWithImpl<$Res> - implements _$AssetsCopyWith<$Res> { - __$AssetsCopyWithImpl(this._self, this._then); - - final _Assets _self; - final $Res Function(_Assets) _then; - - /// Create a copy of Assets - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? url = freezed, Object? id = freezed, Object? nodeId = freezed, Object? name = freezed, Object? label = freezed, Object? uploader = freezed, Object? contentType = freezed, Object? state = freezed, Object? size = freezed, Object? downloadCount = freezed, Object? createdAt = freezed, Object? updatedAt = freezed, Object? browserDownloadUrl = freezed,}) { - return _then(_Assets( - url: freezed == url - ? _self.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as int?, - nodeId: freezed == nodeId - ? _self.nodeId - : nodeId // ignore: cast_nullable_to_non_nullable - as String?, - name: freezed == name - ? _self.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - label: freezed == label - ? _self.label - : label // ignore: cast_nullable_to_non_nullable - as dynamic, - uploader: freezed == uploader - ? _self.uploader - : uploader // ignore: cast_nullable_to_non_nullable - as Uploader?, - contentType: freezed == contentType - ? _self.contentType - : contentType // ignore: cast_nullable_to_non_nullable - as String?, - state: freezed == state - ? _self.state - : state // ignore: cast_nullable_to_non_nullable - as String?, - size: freezed == size - ? _self.size - : size // ignore: cast_nullable_to_non_nullable - as int?, - downloadCount: freezed == downloadCount - ? _self.downloadCount - : downloadCount // ignore: cast_nullable_to_non_nullable - as int?, - createdAt: freezed == createdAt - ? _self.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as String?, - updatedAt: freezed == updatedAt - ? _self.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as String?, - browserDownloadUrl: freezed == browserDownloadUrl - ? _self.browserDownloadUrl - : browserDownloadUrl // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - - /// Create a copy of Assets - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $UploaderCopyWith<$Res>? get uploader { - if (_self.uploader == null) { - return null; - } - - return $UploaderCopyWith<$Res>(_self.uploader!, (value) { - return _then(_self.copyWith(uploader: value)); - }); - } -} - - -/// @nodoc -mixin _$Uploader { - - String? get login; - - int? get id; - - @JsonKey(name: 'node_id') String? get nodeId; - - @JsonKey(name: 'avatar_url') String? get avatarUrl; - - @JsonKey(name: 'gravatar_id') String? get gravatarId; - - String? get url; - - @JsonKey(name: 'html_url') String? get htmlUrl; - - @JsonKey(name: 'followers_url') String? get followersUrl; - - @JsonKey(name: 'following_url') String? get followingUrl; - - @JsonKey(name: 'gists_url') String? get gistsUrl; - - @JsonKey(name: 'starred_url') String? get starredUrl; - - @JsonKey(name: 'subscriptions_url') String? get subscriptionsUrl; - - @JsonKey(name: 'organizations_url') String? get organizationsUrl; - - @JsonKey(name: 'repos_url') String? get reposUrl; - - @JsonKey(name: 'events_url') String? get eventsUrl; - - @JsonKey(name: 'received_events_url') String? get receivedEventsUrl; - - String? get type; - - @JsonKey(name: 'user_view_type') String? get userViewType; - - @JsonKey(name: 'site_admin') bool? get siteAdmin; - - /// Create a copy of Uploader - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $UploaderCopyWith get copyWith => - _$UploaderCopyWithImpl(this as Uploader, _$identity); - - /// Serializes this Uploader to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Uploader && - (identical(other.login, login) || other.login == login) && - (identical(other.id, id) || other.id == id) && - (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && - (identical(other.avatarUrl, avatarUrl) || - other.avatarUrl == avatarUrl) && - (identical(other.gravatarId, gravatarId) || - other.gravatarId == gravatarId) && - (identical(other.url, url) || other.url == url) && - (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && - (identical(other.followersUrl, followersUrl) || - other.followersUrl == followersUrl) && - (identical(other.followingUrl, followingUrl) || - other.followingUrl == followingUrl) && - (identical(other.gistsUrl, gistsUrl) || - other.gistsUrl == gistsUrl) && - (identical(other.starredUrl, starredUrl) || - other.starredUrl == starredUrl) && - (identical(other.subscriptionsUrl, subscriptionsUrl) || - other.subscriptionsUrl == subscriptionsUrl) && - (identical(other.organizationsUrl, organizationsUrl) || - other.organizationsUrl == organizationsUrl) && - (identical(other.reposUrl, reposUrl) || - other.reposUrl == reposUrl) && - (identical(other.eventsUrl, eventsUrl) || - other.eventsUrl == eventsUrl) && - (identical(other.receivedEventsUrl, receivedEventsUrl) || - other.receivedEventsUrl == receivedEventsUrl) && - (identical(other.type, type) || other.type == type) && - (identical(other.userViewType, userViewType) || - other.userViewType == userViewType) && - (identical(other.siteAdmin, siteAdmin) || - other.siteAdmin == siteAdmin)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hashAll([ - runtimeType, - login, - id, - nodeId, - avatarUrl, - gravatarId, - url, - htmlUrl, - followersUrl, - followingUrl, - gistsUrl, - starredUrl, - subscriptionsUrl, - organizationsUrl, - reposUrl, - eventsUrl, - receivedEventsUrl, - type, - userViewType, - siteAdmin - ]); - - @override - String toString() { - return 'Uploader(login: $login, id: $id, nodeId: $nodeId, avatarUrl: $avatarUrl, gravatarId: $gravatarId, url: $url, htmlUrl: $htmlUrl, followersUrl: $followersUrl, followingUrl: $followingUrl, gistsUrl: $gistsUrl, starredUrl: $starredUrl, subscriptionsUrl: $subscriptionsUrl, organizationsUrl: $organizationsUrl, reposUrl: $reposUrl, eventsUrl: $eventsUrl, receivedEventsUrl: $receivedEventsUrl, type: $type, userViewType: $userViewType, siteAdmin: $siteAdmin)'; - } - - -} - -/// @nodoc -abstract mixin class $UploaderCopyWith<$Res> { - factory $UploaderCopyWith(Uploader value, - $Res Function(Uploader) _then) = _$UploaderCopyWithImpl; - - @useResult - $Res call({ - String? login, int? id, @JsonKey(name: 'node_id') String? nodeId, @JsonKey( - name: 'avatar_url') String? avatarUrl, @JsonKey( - name: 'gravatar_id') String? gravatarId, String? url, @JsonKey( - name: 'html_url') String? htmlUrl, @JsonKey( - name: 'followers_url') String? followersUrl, @JsonKey( - name: 'following_url') String? followingUrl, @JsonKey( - name: 'gists_url') String? gistsUrl, @JsonKey( - name: 'starred_url') String? starredUrl, @JsonKey( - name: 'subscriptions_url') String? subscriptionsUrl, @JsonKey( - name: 'organizations_url') String? organizationsUrl, @JsonKey( - name: 'repos_url') String? reposUrl, @JsonKey( - name: 'events_url') String? eventsUrl, @JsonKey( - name: 'received_events_url') String? receivedEventsUrl, String? type, @JsonKey( - name: 'user_view_type') String? userViewType, @JsonKey( - name: 'site_admin') bool? siteAdmin - }); - - -} - -/// @nodoc -class _$UploaderCopyWithImpl<$Res> - implements $UploaderCopyWith<$Res> { - _$UploaderCopyWithImpl(this._self, this._then); - - final Uploader _self; - final $Res Function(Uploader) _then; - - /// Create a copy of Uploader - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? login = freezed, Object? id = freezed, Object? nodeId = freezed, Object? avatarUrl = freezed, Object? gravatarId = freezed, Object? url = freezed, Object? htmlUrl = freezed, Object? followersUrl = freezed, Object? followingUrl = freezed, Object? gistsUrl = freezed, Object? starredUrl = freezed, Object? subscriptionsUrl = freezed, Object? organizationsUrl = freezed, Object? reposUrl = freezed, Object? eventsUrl = freezed, Object? receivedEventsUrl = freezed, Object? type = freezed, Object? userViewType = freezed, Object? siteAdmin = freezed,}) { - return _then(_self.copyWith( - login: freezed == login - ? _self.login - : login // ignore: cast_nullable_to_non_nullable - as String?, - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as int?, - nodeId: freezed == nodeId - ? _self.nodeId - : nodeId // ignore: cast_nullable_to_non_nullable - as String?, - avatarUrl: freezed == avatarUrl - ? _self.avatarUrl - : avatarUrl // ignore: cast_nullable_to_non_nullable - as String?, - gravatarId: freezed == gravatarId - ? _self.gravatarId - : gravatarId // ignore: cast_nullable_to_non_nullable - as String?, - url: freezed == url - ? _self.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - htmlUrl: freezed == htmlUrl - ? _self.htmlUrl - : htmlUrl // ignore: cast_nullable_to_non_nullable - as String?, - followersUrl: freezed == followersUrl - ? _self.followersUrl - : followersUrl // ignore: cast_nullable_to_non_nullable - as String?, - followingUrl: freezed == followingUrl - ? _self.followingUrl - : followingUrl // ignore: cast_nullable_to_non_nullable - as String?, - gistsUrl: freezed == gistsUrl - ? _self.gistsUrl - : gistsUrl // ignore: cast_nullable_to_non_nullable - as String?, - starredUrl: freezed == starredUrl - ? _self.starredUrl - : starredUrl // ignore: cast_nullable_to_non_nullable - as String?, - subscriptionsUrl: freezed == subscriptionsUrl - ? _self.subscriptionsUrl - : subscriptionsUrl // ignore: cast_nullable_to_non_nullable - as String?, - organizationsUrl: freezed == organizationsUrl - ? _self.organizationsUrl - : organizationsUrl // ignore: cast_nullable_to_non_nullable - as String?, - reposUrl: freezed == reposUrl - ? _self.reposUrl - : reposUrl // ignore: cast_nullable_to_non_nullable - as String?, - eventsUrl: freezed == eventsUrl - ? _self.eventsUrl - : eventsUrl // ignore: cast_nullable_to_non_nullable - as String?, - receivedEventsUrl: freezed == receivedEventsUrl - ? _self.receivedEventsUrl - : receivedEventsUrl // ignore: cast_nullable_to_non_nullable - as String?, - type: freezed == type - ? _self.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - userViewType: freezed == userViewType - ? _self.userViewType - : userViewType // ignore: cast_nullable_to_non_nullable - as String?, - siteAdmin: freezed == siteAdmin - ? _self.siteAdmin - : siteAdmin // ignore: cast_nullable_to_non_nullable - as bool?, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _Uploader implements Uploader { - const _Uploader( - {this.login, this.id, @JsonKey(name: 'node_id') this.nodeId, @JsonKey( - name: 'avatar_url') this.avatarUrl, @JsonKey( - name: 'gravatar_id') this.gravatarId, this.url, @JsonKey( - name: 'html_url') this.htmlUrl, @JsonKey( - name: 'followers_url') this.followersUrl, @JsonKey( - name: 'following_url') this.followingUrl, @JsonKey( - name: 'gists_url') this.gistsUrl, @JsonKey( - name: 'starred_url') this.starredUrl, @JsonKey( - name: 'subscriptions_url') this.subscriptionsUrl, @JsonKey( - name: 'organizations_url') this.organizationsUrl, @JsonKey( - name: 'repos_url') this.reposUrl, @JsonKey( - name: 'events_url') this.eventsUrl, @JsonKey( - name: 'received_events_url') this.receivedEventsUrl, this.type, @JsonKey( - name: 'user_view_type') this.userViewType, @JsonKey( - name: 'site_admin') this.siteAdmin}); - - factory _Uploader.fromJson(Map json) => - _$UploaderFromJson(json); - - @override final String? login; - @override final int? id; - @override - @JsonKey(name: 'node_id') - final String? nodeId; - @override - @JsonKey(name: 'avatar_url') - final String? avatarUrl; - @override - @JsonKey(name: 'gravatar_id') - final String? gravatarId; - @override final String? url; - @override - @JsonKey(name: 'html_url') - final String? htmlUrl; - @override - @JsonKey(name: 'followers_url') - final String? followersUrl; - @override - @JsonKey(name: 'following_url') - final String? followingUrl; - @override - @JsonKey(name: 'gists_url') - final String? gistsUrl; - @override - @JsonKey(name: 'starred_url') - final String? starredUrl; - @override - @JsonKey(name: 'subscriptions_url') - final String? subscriptionsUrl; - @override - @JsonKey(name: 'organizations_url') - final String? organizationsUrl; - @override - @JsonKey(name: 'repos_url') - final String? reposUrl; - @override - @JsonKey(name: 'events_url') - final String? eventsUrl; - @override - @JsonKey(name: 'received_events_url') - final String? receivedEventsUrl; - @override final String? type; - @override - @JsonKey(name: 'user_view_type') - final String? userViewType; - @override - @JsonKey(name: 'site_admin') - final bool? siteAdmin; - - /// Create a copy of Uploader - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$UploaderCopyWith<_Uploader> get copyWith => - __$UploaderCopyWithImpl<_Uploader>(this, _$identity); - - @override - Map toJson() { - return _$UploaderToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Uploader && - (identical(other.login, login) || other.login == login) && - (identical(other.id, id) || other.id == id) && - (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && - (identical(other.avatarUrl, avatarUrl) || - other.avatarUrl == avatarUrl) && - (identical(other.gravatarId, gravatarId) || - other.gravatarId == gravatarId) && - (identical(other.url, url) || other.url == url) && - (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && - (identical(other.followersUrl, followersUrl) || - other.followersUrl == followersUrl) && - (identical(other.followingUrl, followingUrl) || - other.followingUrl == followingUrl) && - (identical(other.gistsUrl, gistsUrl) || - other.gistsUrl == gistsUrl) && - (identical(other.starredUrl, starredUrl) || - other.starredUrl == starredUrl) && - (identical(other.subscriptionsUrl, subscriptionsUrl) || - other.subscriptionsUrl == subscriptionsUrl) && - (identical(other.organizationsUrl, organizationsUrl) || - other.organizationsUrl == organizationsUrl) && - (identical(other.reposUrl, reposUrl) || - other.reposUrl == reposUrl) && - (identical(other.eventsUrl, eventsUrl) || - other.eventsUrl == eventsUrl) && - (identical(other.receivedEventsUrl, receivedEventsUrl) || - other.receivedEventsUrl == receivedEventsUrl) && - (identical(other.type, type) || other.type == type) && - (identical(other.userViewType, userViewType) || - other.userViewType == userViewType) && - (identical(other.siteAdmin, siteAdmin) || - other.siteAdmin == siteAdmin)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hashAll([ - runtimeType, - login, - id, - nodeId, - avatarUrl, - gravatarId, - url, - htmlUrl, - followersUrl, - followingUrl, - gistsUrl, - starredUrl, - subscriptionsUrl, - organizationsUrl, - reposUrl, - eventsUrl, - receivedEventsUrl, - type, - userViewType, - siteAdmin - ]); - - @override - String toString() { - return 'Uploader(login: $login, id: $id, nodeId: $nodeId, avatarUrl: $avatarUrl, gravatarId: $gravatarId, url: $url, htmlUrl: $htmlUrl, followersUrl: $followersUrl, followingUrl: $followingUrl, gistsUrl: $gistsUrl, starredUrl: $starredUrl, subscriptionsUrl: $subscriptionsUrl, organizationsUrl: $organizationsUrl, reposUrl: $reposUrl, eventsUrl: $eventsUrl, receivedEventsUrl: $receivedEventsUrl, type: $type, userViewType: $userViewType, siteAdmin: $siteAdmin)'; - } - - -} - -/// @nodoc -abstract mixin class _$UploaderCopyWith<$Res> - implements $UploaderCopyWith<$Res> { - factory _$UploaderCopyWith(_Uploader value, - $Res Function(_Uploader) _then) = __$UploaderCopyWithImpl; - - @override - @useResult - $Res call({ - String? login, int? id, @JsonKey(name: 'node_id') String? nodeId, @JsonKey( - name: 'avatar_url') String? avatarUrl, @JsonKey( - name: 'gravatar_id') String? gravatarId, String? url, @JsonKey( - name: 'html_url') String? htmlUrl, @JsonKey( - name: 'followers_url') String? followersUrl, @JsonKey( - name: 'following_url') String? followingUrl, @JsonKey( - name: 'gists_url') String? gistsUrl, @JsonKey( - name: 'starred_url') String? starredUrl, @JsonKey( - name: 'subscriptions_url') String? subscriptionsUrl, @JsonKey( - name: 'organizations_url') String? organizationsUrl, @JsonKey( - name: 'repos_url') String? reposUrl, @JsonKey( - name: 'events_url') String? eventsUrl, @JsonKey( - name: 'received_events_url') String? receivedEventsUrl, String? type, @JsonKey( - name: 'user_view_type') String? userViewType, @JsonKey( - name: 'site_admin') bool? siteAdmin - }); - - -} - -/// @nodoc -class __$UploaderCopyWithImpl<$Res> - implements _$UploaderCopyWith<$Res> { - __$UploaderCopyWithImpl(this._self, this._then); - - final _Uploader _self; - final $Res Function(_Uploader) _then; - - /// Create a copy of Uploader - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? login = freezed, Object? id = freezed, Object? nodeId = freezed, Object? avatarUrl = freezed, Object? gravatarId = freezed, Object? url = freezed, Object? htmlUrl = freezed, Object? followersUrl = freezed, Object? followingUrl = freezed, Object? gistsUrl = freezed, Object? starredUrl = freezed, Object? subscriptionsUrl = freezed, Object? organizationsUrl = freezed, Object? reposUrl = freezed, Object? eventsUrl = freezed, Object? receivedEventsUrl = freezed, Object? type = freezed, Object? userViewType = freezed, Object? siteAdmin = freezed,}) { - return _then(_Uploader( - login: freezed == login - ? _self.login - : login // ignore: cast_nullable_to_non_nullable - as String?, - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as int?, - nodeId: freezed == nodeId - ? _self.nodeId - : nodeId // ignore: cast_nullable_to_non_nullable - as String?, - avatarUrl: freezed == avatarUrl - ? _self.avatarUrl - : avatarUrl // ignore: cast_nullable_to_non_nullable - as String?, - gravatarId: freezed == gravatarId - ? _self.gravatarId - : gravatarId // ignore: cast_nullable_to_non_nullable - as String?, - url: freezed == url - ? _self.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - htmlUrl: freezed == htmlUrl - ? _self.htmlUrl - : htmlUrl // ignore: cast_nullable_to_non_nullable - as String?, - followersUrl: freezed == followersUrl - ? _self.followersUrl - : followersUrl // ignore: cast_nullable_to_non_nullable - as String?, - followingUrl: freezed == followingUrl - ? _self.followingUrl - : followingUrl // ignore: cast_nullable_to_non_nullable - as String?, - gistsUrl: freezed == gistsUrl - ? _self.gistsUrl - : gistsUrl // ignore: cast_nullable_to_non_nullable - as String?, - starredUrl: freezed == starredUrl - ? _self.starredUrl - : starredUrl // ignore: cast_nullable_to_non_nullable - as String?, - subscriptionsUrl: freezed == subscriptionsUrl - ? _self.subscriptionsUrl - : subscriptionsUrl // ignore: cast_nullable_to_non_nullable - as String?, - organizationsUrl: freezed == organizationsUrl - ? _self.organizationsUrl - : organizationsUrl // ignore: cast_nullable_to_non_nullable - as String?, - reposUrl: freezed == reposUrl - ? _self.reposUrl - : reposUrl // ignore: cast_nullable_to_non_nullable - as String?, - eventsUrl: freezed == eventsUrl - ? _self.eventsUrl - : eventsUrl // ignore: cast_nullable_to_non_nullable - as String?, - receivedEventsUrl: freezed == receivedEventsUrl - ? _self.receivedEventsUrl - : receivedEventsUrl // ignore: cast_nullable_to_non_nullable - as String?, - type: freezed == type - ? _self.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - userViewType: freezed == userViewType - ? _self.userViewType - : userViewType // ignore: cast_nullable_to_non_nullable - as String?, - siteAdmin: freezed == siteAdmin - ? _self.siteAdmin - : siteAdmin // ignore: cast_nullable_to_non_nullable - as bool?, - )); - } - - -} - - -/// @nodoc -mixin _$Author { - - String? get login; - - int? get id; - - @JsonKey(name: 'node_id') String? get nodeId; - - @JsonKey(name: 'avatar_url') String? get avatarUrl; - - @JsonKey(name: 'gravatar_id') String? get gravatarId; - - String? get url; - - @JsonKey(name: 'html_url') String? get htmlUrl; - - @JsonKey(name: 'followers_url') String? get followersUrl; - - @JsonKey(name: 'following_url') String? get followingUrl; - - @JsonKey(name: 'gists_url') String? get gistsUrl; - - @JsonKey(name: 'starred_url') String? get starredUrl; - - @JsonKey(name: 'subscriptions_url') String? get subscriptionsUrl; - - @JsonKey(name: 'organizations_url') String? get organizationsUrl; - - @JsonKey(name: 'repos_url') String? get reposUrl; - - @JsonKey(name: 'events_url') String? get eventsUrl; - - @JsonKey(name: 'received_events_url') String? get receivedEventsUrl; - - String? get type; - - @JsonKey(name: 'user_view_type') String? get userViewType; - - @JsonKey(name: 'site_admin') bool? get siteAdmin; - - /// Create a copy of Author - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $AuthorCopyWith get copyWith => - _$AuthorCopyWithImpl(this as Author, _$identity); - - /// Serializes this Author to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Author && - (identical(other.login, login) || other.login == login) && - (identical(other.id, id) || other.id == id) && - (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && - (identical(other.avatarUrl, avatarUrl) || - other.avatarUrl == avatarUrl) && - (identical(other.gravatarId, gravatarId) || - other.gravatarId == gravatarId) && - (identical(other.url, url) || other.url == url) && - (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && - (identical(other.followersUrl, followersUrl) || - other.followersUrl == followersUrl) && - (identical(other.followingUrl, followingUrl) || - other.followingUrl == followingUrl) && - (identical(other.gistsUrl, gistsUrl) || - other.gistsUrl == gistsUrl) && - (identical(other.starredUrl, starredUrl) || - other.starredUrl == starredUrl) && - (identical(other.subscriptionsUrl, subscriptionsUrl) || - other.subscriptionsUrl == subscriptionsUrl) && - (identical(other.organizationsUrl, organizationsUrl) || - other.organizationsUrl == organizationsUrl) && - (identical(other.reposUrl, reposUrl) || - other.reposUrl == reposUrl) && - (identical(other.eventsUrl, eventsUrl) || - other.eventsUrl == eventsUrl) && - (identical(other.receivedEventsUrl, receivedEventsUrl) || - other.receivedEventsUrl == receivedEventsUrl) && - (identical(other.type, type) || other.type == type) && - (identical(other.userViewType, userViewType) || - other.userViewType == userViewType) && - (identical(other.siteAdmin, siteAdmin) || - other.siteAdmin == siteAdmin)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hashAll([ - runtimeType, - login, - id, - nodeId, - avatarUrl, - gravatarId, - url, - htmlUrl, - followersUrl, - followingUrl, - gistsUrl, - starredUrl, - subscriptionsUrl, - organizationsUrl, - reposUrl, - eventsUrl, - receivedEventsUrl, - type, - userViewType, - siteAdmin - ]); - - @override - String toString() { - return 'Author(login: $login, id: $id, nodeId: $nodeId, avatarUrl: $avatarUrl, gravatarId: $gravatarId, url: $url, htmlUrl: $htmlUrl, followersUrl: $followersUrl, followingUrl: $followingUrl, gistsUrl: $gistsUrl, starredUrl: $starredUrl, subscriptionsUrl: $subscriptionsUrl, organizationsUrl: $organizationsUrl, reposUrl: $reposUrl, eventsUrl: $eventsUrl, receivedEventsUrl: $receivedEventsUrl, type: $type, userViewType: $userViewType, siteAdmin: $siteAdmin)'; - } - - -} - -/// @nodoc -abstract mixin class $AuthorCopyWith<$Res> { - factory $AuthorCopyWith(Author value, - $Res Function(Author) _then) = _$AuthorCopyWithImpl; - - @useResult - $Res call({ - String? login, int? id, @JsonKey(name: 'node_id') String? nodeId, @JsonKey( - name: 'avatar_url') String? avatarUrl, @JsonKey( - name: 'gravatar_id') String? gravatarId, String? url, @JsonKey( - name: 'html_url') String? htmlUrl, @JsonKey( - name: 'followers_url') String? followersUrl, @JsonKey( - name: 'following_url') String? followingUrl, @JsonKey( - name: 'gists_url') String? gistsUrl, @JsonKey( - name: 'starred_url') String? starredUrl, @JsonKey( - name: 'subscriptions_url') String? subscriptionsUrl, @JsonKey( - name: 'organizations_url') String? organizationsUrl, @JsonKey( - name: 'repos_url') String? reposUrl, @JsonKey( - name: 'events_url') String? eventsUrl, @JsonKey( - name: 'received_events_url') String? receivedEventsUrl, String? type, @JsonKey( - name: 'user_view_type') String? userViewType, @JsonKey( - name: 'site_admin') bool? siteAdmin - }); - - -} - -/// @nodoc -class _$AuthorCopyWithImpl<$Res> - implements $AuthorCopyWith<$Res> { - _$AuthorCopyWithImpl(this._self, this._then); - - final Author _self; - final $Res Function(Author) _then; - - /// Create a copy of Author - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? login = freezed, Object? id = freezed, Object? nodeId = freezed, Object? avatarUrl = freezed, Object? gravatarId = freezed, Object? url = freezed, Object? htmlUrl = freezed, Object? followersUrl = freezed, Object? followingUrl = freezed, Object? gistsUrl = freezed, Object? starredUrl = freezed, Object? subscriptionsUrl = freezed, Object? organizationsUrl = freezed, Object? reposUrl = freezed, Object? eventsUrl = freezed, Object? receivedEventsUrl = freezed, Object? type = freezed, Object? userViewType = freezed, Object? siteAdmin = freezed,}) { - return _then(_self.copyWith( - login: freezed == login - ? _self.login - : login // ignore: cast_nullable_to_non_nullable - as String?, - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as int?, - nodeId: freezed == nodeId - ? _self.nodeId - : nodeId // ignore: cast_nullable_to_non_nullable - as String?, - avatarUrl: freezed == avatarUrl - ? _self.avatarUrl - : avatarUrl // ignore: cast_nullable_to_non_nullable - as String?, - gravatarId: freezed == gravatarId - ? _self.gravatarId - : gravatarId // ignore: cast_nullable_to_non_nullable - as String?, - url: freezed == url - ? _self.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - htmlUrl: freezed == htmlUrl - ? _self.htmlUrl - : htmlUrl // ignore: cast_nullable_to_non_nullable - as String?, - followersUrl: freezed == followersUrl - ? _self.followersUrl - : followersUrl // ignore: cast_nullable_to_non_nullable - as String?, - followingUrl: freezed == followingUrl - ? _self.followingUrl - : followingUrl // ignore: cast_nullable_to_non_nullable - as String?, - gistsUrl: freezed == gistsUrl - ? _self.gistsUrl - : gistsUrl // ignore: cast_nullable_to_non_nullable - as String?, - starredUrl: freezed == starredUrl - ? _self.starredUrl - : starredUrl // ignore: cast_nullable_to_non_nullable - as String?, - subscriptionsUrl: freezed == subscriptionsUrl - ? _self.subscriptionsUrl - : subscriptionsUrl // ignore: cast_nullable_to_non_nullable - as String?, - organizationsUrl: freezed == organizationsUrl - ? _self.organizationsUrl - : organizationsUrl // ignore: cast_nullable_to_non_nullable - as String?, - reposUrl: freezed == reposUrl - ? _self.reposUrl - : reposUrl // ignore: cast_nullable_to_non_nullable - as String?, - eventsUrl: freezed == eventsUrl - ? _self.eventsUrl - : eventsUrl // ignore: cast_nullable_to_non_nullable - as String?, - receivedEventsUrl: freezed == receivedEventsUrl - ? _self.receivedEventsUrl - : receivedEventsUrl // ignore: cast_nullable_to_non_nullable - as String?, - type: freezed == type - ? _self.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - userViewType: freezed == userViewType - ? _self.userViewType - : userViewType // ignore: cast_nullable_to_non_nullable - as String?, - siteAdmin: freezed == siteAdmin - ? _self.siteAdmin - : siteAdmin // ignore: cast_nullable_to_non_nullable - as bool?, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _Author implements Author { - const _Author( - {this.login, this.id, @JsonKey(name: 'node_id') this.nodeId, @JsonKey( - name: 'avatar_url') this.avatarUrl, @JsonKey( - name: 'gravatar_id') this.gravatarId, this.url, @JsonKey( - name: 'html_url') this.htmlUrl, @JsonKey( - name: 'followers_url') this.followersUrl, @JsonKey( - name: 'following_url') this.followingUrl, @JsonKey( - name: 'gists_url') this.gistsUrl, @JsonKey( - name: 'starred_url') this.starredUrl, @JsonKey( - name: 'subscriptions_url') this.subscriptionsUrl, @JsonKey( - name: 'organizations_url') this.organizationsUrl, @JsonKey( - name: 'repos_url') this.reposUrl, @JsonKey( - name: 'events_url') this.eventsUrl, @JsonKey( - name: 'received_events_url') this.receivedEventsUrl, this.type, @JsonKey( - name: 'user_view_type') this.userViewType, @JsonKey( - name: 'site_admin') this.siteAdmin}); - - factory _Author.fromJson(Map json) => _$AuthorFromJson(json); - - @override final String? login; - @override final int? id; - @override - @JsonKey(name: 'node_id') - final String? nodeId; - @override - @JsonKey(name: 'avatar_url') - final String? avatarUrl; - @override - @JsonKey(name: 'gravatar_id') - final String? gravatarId; - @override final String? url; - @override - @JsonKey(name: 'html_url') - final String? htmlUrl; - @override - @JsonKey(name: 'followers_url') - final String? followersUrl; - @override - @JsonKey(name: 'following_url') - final String? followingUrl; - @override - @JsonKey(name: 'gists_url') - final String? gistsUrl; - @override - @JsonKey(name: 'starred_url') - final String? starredUrl; - @override - @JsonKey(name: 'subscriptions_url') - final String? subscriptionsUrl; - @override - @JsonKey(name: 'organizations_url') - final String? organizationsUrl; - @override - @JsonKey(name: 'repos_url') - final String? reposUrl; - @override - @JsonKey(name: 'events_url') - final String? eventsUrl; - @override - @JsonKey(name: 'received_events_url') - final String? receivedEventsUrl; - @override final String? type; - @override - @JsonKey(name: 'user_view_type') - final String? userViewType; - @override - @JsonKey(name: 'site_admin') - final bool? siteAdmin; - - /// Create a copy of Author - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$AuthorCopyWith<_Author> get copyWith => - __$AuthorCopyWithImpl<_Author>(this, _$identity); - - @override - Map toJson() { - return _$AuthorToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Author && - (identical(other.login, login) || other.login == login) && - (identical(other.id, id) || other.id == id) && - (identical(other.nodeId, nodeId) || other.nodeId == nodeId) && - (identical(other.avatarUrl, avatarUrl) || - other.avatarUrl == avatarUrl) && - (identical(other.gravatarId, gravatarId) || - other.gravatarId == gravatarId) && - (identical(other.url, url) || other.url == url) && - (identical(other.htmlUrl, htmlUrl) || other.htmlUrl == htmlUrl) && - (identical(other.followersUrl, followersUrl) || - other.followersUrl == followersUrl) && - (identical(other.followingUrl, followingUrl) || - other.followingUrl == followingUrl) && - (identical(other.gistsUrl, gistsUrl) || - other.gistsUrl == gistsUrl) && - (identical(other.starredUrl, starredUrl) || - other.starredUrl == starredUrl) && - (identical(other.subscriptionsUrl, subscriptionsUrl) || - other.subscriptionsUrl == subscriptionsUrl) && - (identical(other.organizationsUrl, organizationsUrl) || - other.organizationsUrl == organizationsUrl) && - (identical(other.reposUrl, reposUrl) || - other.reposUrl == reposUrl) && - (identical(other.eventsUrl, eventsUrl) || - other.eventsUrl == eventsUrl) && - (identical(other.receivedEventsUrl, receivedEventsUrl) || - other.receivedEventsUrl == receivedEventsUrl) && - (identical(other.type, type) || other.type == type) && - (identical(other.userViewType, userViewType) || - other.userViewType == userViewType) && - (identical(other.siteAdmin, siteAdmin) || - other.siteAdmin == siteAdmin)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hashAll([ - runtimeType, - login, - id, - nodeId, - avatarUrl, - gravatarId, - url, - htmlUrl, - followersUrl, - followingUrl, - gistsUrl, - starredUrl, - subscriptionsUrl, - organizationsUrl, - reposUrl, - eventsUrl, - receivedEventsUrl, - type, - userViewType, - siteAdmin - ]); - - @override - String toString() { - return 'Author(login: $login, id: $id, nodeId: $nodeId, avatarUrl: $avatarUrl, gravatarId: $gravatarId, url: $url, htmlUrl: $htmlUrl, followersUrl: $followersUrl, followingUrl: $followingUrl, gistsUrl: $gistsUrl, starredUrl: $starredUrl, subscriptionsUrl: $subscriptionsUrl, organizationsUrl: $organizationsUrl, reposUrl: $reposUrl, eventsUrl: $eventsUrl, receivedEventsUrl: $receivedEventsUrl, type: $type, userViewType: $userViewType, siteAdmin: $siteAdmin)'; - } - - -} - -/// @nodoc -abstract mixin class _$AuthorCopyWith<$Res> implements $AuthorCopyWith<$Res> { - factory _$AuthorCopyWith(_Author value, - $Res Function(_Author) _then) = __$AuthorCopyWithImpl; - - @override - @useResult - $Res call({ - String? login, int? id, @JsonKey(name: 'node_id') String? nodeId, @JsonKey( - name: 'avatar_url') String? avatarUrl, @JsonKey( - name: 'gravatar_id') String? gravatarId, String? url, @JsonKey( - name: 'html_url') String? htmlUrl, @JsonKey( - name: 'followers_url') String? followersUrl, @JsonKey( - name: 'following_url') String? followingUrl, @JsonKey( - name: 'gists_url') String? gistsUrl, @JsonKey( - name: 'starred_url') String? starredUrl, @JsonKey( - name: 'subscriptions_url') String? subscriptionsUrl, @JsonKey( - name: 'organizations_url') String? organizationsUrl, @JsonKey( - name: 'repos_url') String? reposUrl, @JsonKey( - name: 'events_url') String? eventsUrl, @JsonKey( - name: 'received_events_url') String? receivedEventsUrl, String? type, @JsonKey( - name: 'user_view_type') String? userViewType, @JsonKey( - name: 'site_admin') bool? siteAdmin - }); - - -} - -/// @nodoc -class __$AuthorCopyWithImpl<$Res> - implements _$AuthorCopyWith<$Res> { - __$AuthorCopyWithImpl(this._self, this._then); - - final _Author _self; - final $Res Function(_Author) _then; - - /// Create a copy of Author - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? login = freezed, Object? id = freezed, Object? nodeId = freezed, Object? avatarUrl = freezed, Object? gravatarId = freezed, Object? url = freezed, Object? htmlUrl = freezed, Object? followersUrl = freezed, Object? followingUrl = freezed, Object? gistsUrl = freezed, Object? starredUrl = freezed, Object? subscriptionsUrl = freezed, Object? organizationsUrl = freezed, Object? reposUrl = freezed, Object? eventsUrl = freezed, Object? receivedEventsUrl = freezed, Object? type = freezed, Object? userViewType = freezed, Object? siteAdmin = freezed,}) { - return _then(_Author( - login: freezed == login - ? _self.login - : login // ignore: cast_nullable_to_non_nullable - as String?, - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as int?, - nodeId: freezed == nodeId - ? _self.nodeId - : nodeId // ignore: cast_nullable_to_non_nullable - as String?, - avatarUrl: freezed == avatarUrl - ? _self.avatarUrl - : avatarUrl // ignore: cast_nullable_to_non_nullable - as String?, - gravatarId: freezed == gravatarId - ? _self.gravatarId - : gravatarId // ignore: cast_nullable_to_non_nullable - as String?, - url: freezed == url - ? _self.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - htmlUrl: freezed == htmlUrl - ? _self.htmlUrl - : htmlUrl // ignore: cast_nullable_to_non_nullable - as String?, - followersUrl: freezed == followersUrl - ? _self.followersUrl - : followersUrl // ignore: cast_nullable_to_non_nullable - as String?, - followingUrl: freezed == followingUrl - ? _self.followingUrl - : followingUrl // ignore: cast_nullable_to_non_nullable - as String?, - gistsUrl: freezed == gistsUrl - ? _self.gistsUrl - : gistsUrl // ignore: cast_nullable_to_non_nullable - as String?, - starredUrl: freezed == starredUrl - ? _self.starredUrl - : starredUrl // ignore: cast_nullable_to_non_nullable - as String?, - subscriptionsUrl: freezed == subscriptionsUrl - ? _self.subscriptionsUrl - : subscriptionsUrl // ignore: cast_nullable_to_non_nullable - as String?, - organizationsUrl: freezed == organizationsUrl - ? _self.organizationsUrl - : organizationsUrl // ignore: cast_nullable_to_non_nullable - as String?, - reposUrl: freezed == reposUrl - ? _self.reposUrl - : reposUrl // ignore: cast_nullable_to_non_nullable - as String?, - eventsUrl: freezed == eventsUrl - ? _self.eventsUrl - : eventsUrl // ignore: cast_nullable_to_non_nullable - as String?, - receivedEventsUrl: freezed == receivedEventsUrl - ? _self.receivedEventsUrl - : receivedEventsUrl // ignore: cast_nullable_to_non_nullable - as String?, - type: freezed == type - ? _self.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - userViewType: freezed == userViewType - ? _self.userViewType - : userViewType // ignore: cast_nullable_to_non_nullable - as String?, - siteAdmin: freezed == siteAdmin - ? _self.siteAdmin - : siteAdmin // ignore: cast_nullable_to_non_nullable - as bool?, - )); - } - - -} - -// dart format on diff --git a/lib/common/models/github.g.dart b/lib/common/models/github.g.dart deleted file mode 100644 index 55c4a06..0000000 --- a/lib/common/models/github.g.dart +++ /dev/null @@ -1,183 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'github.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_GithubRelease _$GithubReleaseFromJson(Map json) => - _GithubRelease( - url: json['url'] as String?, - assetsUrl: json['assets_url'] as String?, - uploadUrl: json['upload_url'] as String?, - htmlUrl: json['html_url'] as String?, - id: (json['id'] as num?)?.toInt(), - author: - json['author'] == null - ? null - : Author.fromJson(json['author'] as Map), - nodeId: json['node_id'] as String?, - tagName: json['tag_name'] as String?, - targetCommitish: json['target_commitish'] as String?, - name: json['name'] as String?, - draft: json['draft'] as bool?, - prerelease: json['prerelease'] as bool?, - createdAt: json['created_at'] as String?, - publishedAt: json['published_at'] as String?, - assets: - (json['assets'] as List?) - ?.map((e) => Assets.fromJson(e as Map)) - .toList(), - tarballUrl: json['tarball_url'] as String?, - zipballUrl: json['zipball_url'] as String?, - body: json['body'] as String?, - ); - -Map _$GithubReleaseToJson(_GithubRelease instance) => - { - if (instance.url case final value?) 'url': value, - if (instance.assetsUrl case final value?) 'assets_url': value, - if (instance.uploadUrl case final value?) 'upload_url': value, - if (instance.htmlUrl case final value?) 'html_url': value, - if (instance.id case final value?) 'id': value, - if (instance.author case final value?) 'author': value, - if (instance.nodeId case final value?) 'node_id': value, - if (instance.tagName case final value?) 'tag_name': value, - if (instance.targetCommitish case final value?) 'target_commitish': value, - if (instance.name case final value?) 'name': value, - if (instance.draft case final value?) 'draft': value, - if (instance.prerelease case final value?) 'prerelease': value, - if (instance.createdAt case final value?) 'created_at': value, - if (instance.publishedAt case final value?) 'published_at': value, - if (instance.assets case final value?) 'assets': value, - if (instance.tarballUrl case final value?) 'tarball_url': value, - if (instance.zipballUrl case final value?) 'zipball_url': value, - if (instance.body case final value?) 'body': value, - }; - -_Assets _$AssetsFromJson(Map json) => _Assets( - url: json['url'] as String?, - id: (json['id'] as num?)?.toInt(), - nodeId: json['node_id'] as String?, - name: json['name'] as String?, - label: json['label'], - uploader: - json['uploader'] == null - ? null - : Uploader.fromJson(json['uploader'] as Map), - contentType: json['content_type'] as String?, - state: json['state'] as String?, - size: (json['size'] as num?)?.toInt(), - downloadCount: (json['download_count'] as num?)?.toInt(), - createdAt: json['created_at'] as String?, - updatedAt: json['updated_at'] as String?, - browserDownloadUrl: json['browser_download_url'] as String?, -); - -Map _$AssetsToJson(_Assets instance) => { - if (instance.url case final value?) 'url': value, - if (instance.id case final value?) 'id': value, - if (instance.nodeId case final value?) 'node_id': value, - if (instance.name case final value?) 'name': value, - if (instance.label case final value?) 'label': value, - if (instance.uploader case final value?) 'uploader': value, - if (instance.contentType case final value?) 'content_type': value, - if (instance.state case final value?) 'state': value, - if (instance.size case final value?) 'size': value, - if (instance.downloadCount case final value?) 'download_count': value, - if (instance.createdAt case final value?) 'created_at': value, - if (instance.updatedAt case final value?) 'updated_at': value, - if (instance.browserDownloadUrl case final value?) - 'browser_download_url': value, -}; - -_Uploader _$UploaderFromJson(Map json) => _Uploader( - login: json['login'] as String?, - id: (json['id'] as num?)?.toInt(), - nodeId: json['node_id'] as String?, - avatarUrl: json['avatar_url'] as String?, - gravatarId: json['gravatar_id'] as String?, - url: json['url'] as String?, - htmlUrl: json['html_url'] as String?, - followersUrl: json['followers_url'] as String?, - followingUrl: json['following_url'] as String?, - gistsUrl: json['gists_url'] as String?, - starredUrl: json['starred_url'] as String?, - subscriptionsUrl: json['subscriptions_url'] as String?, - organizationsUrl: json['organizations_url'] as String?, - reposUrl: json['repos_url'] as String?, - eventsUrl: json['events_url'] as String?, - receivedEventsUrl: json['received_events_url'] as String?, - type: json['type'] as String?, - userViewType: json['user_view_type'] as String?, - siteAdmin: json['site_admin'] as bool?, -); - -Map _$UploaderToJson(_Uploader instance) => { - if (instance.login case final value?) 'login': value, - if (instance.id case final value?) 'id': value, - if (instance.nodeId case final value?) 'node_id': value, - if (instance.avatarUrl case final value?) 'avatar_url': value, - if (instance.gravatarId case final value?) 'gravatar_id': value, - if (instance.url case final value?) 'url': value, - if (instance.htmlUrl case final value?) 'html_url': value, - if (instance.followersUrl case final value?) 'followers_url': value, - if (instance.followingUrl case final value?) 'following_url': value, - if (instance.gistsUrl case final value?) 'gists_url': value, - if (instance.starredUrl case final value?) 'starred_url': value, - if (instance.subscriptionsUrl case final value?) 'subscriptions_url': value, - if (instance.organizationsUrl case final value?) 'organizations_url': value, - if (instance.reposUrl case final value?) 'repos_url': value, - if (instance.eventsUrl case final value?) 'events_url': value, - if (instance.receivedEventsUrl case final value?) - 'received_events_url': value, - if (instance.type case final value?) 'type': value, - if (instance.userViewType case final value?) 'user_view_type': value, - if (instance.siteAdmin case final value?) 'site_admin': value, -}; - -_Author _$AuthorFromJson(Map json) => _Author( - login: json['login'] as String?, - id: (json['id'] as num?)?.toInt(), - nodeId: json['node_id'] as String?, - avatarUrl: json['avatar_url'] as String?, - gravatarId: json['gravatar_id'] as String?, - url: json['url'] as String?, - htmlUrl: json['html_url'] as String?, - followersUrl: json['followers_url'] as String?, - followingUrl: json['following_url'] as String?, - gistsUrl: json['gists_url'] as String?, - starredUrl: json['starred_url'] as String?, - subscriptionsUrl: json['subscriptions_url'] as String?, - organizationsUrl: json['organizations_url'] as String?, - reposUrl: json['repos_url'] as String?, - eventsUrl: json['events_url'] as String?, - receivedEventsUrl: json['received_events_url'] as String?, - type: json['type'] as String?, - userViewType: json['user_view_type'] as String?, - siteAdmin: json['site_admin'] as bool?, -); - -Map _$AuthorToJson(_Author instance) => { - if (instance.login case final value?) 'login': value, - if (instance.id case final value?) 'id': value, - if (instance.nodeId case final value?) 'node_id': value, - if (instance.avatarUrl case final value?) 'avatar_url': value, - if (instance.gravatarId case final value?) 'gravatar_id': value, - if (instance.url case final value?) 'url': value, - if (instance.htmlUrl case final value?) 'html_url': value, - if (instance.followersUrl case final value?) 'followers_url': value, - if (instance.followingUrl case final value?) 'following_url': value, - if (instance.gistsUrl case final value?) 'gists_url': value, - if (instance.starredUrl case final value?) 'starred_url': value, - if (instance.subscriptionsUrl case final value?) 'subscriptions_url': value, - if (instance.organizationsUrl case final value?) 'organizations_url': value, - if (instance.reposUrl case final value?) 'repos_url': value, - if (instance.eventsUrl case final value?) 'events_url': value, - if (instance.receivedEventsUrl case final value?) - 'received_events_url': value, - if (instance.type case final value?) 'type': value, - if (instance.userViewType case final value?) 'user_view_type': value, - if (instance.siteAdmin case final value?) 'site_admin': value, -}; diff --git a/lib/common/models/hitokoto.dart b/lib/common/models/hitokoto.dart index 2a4fe0f..1ea54a5 100644 --- a/lib/common/models/hitokoto.dart +++ b/lib/common/models/hitokoto.dart @@ -1,25 +1,61 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +class HitokotoResponse { + int? id; + String? uuid; + String? hitokoto; + String? type; + String? from; + String? fromWho; + String? creator; + int? creatorUid; + int? reviewer; + String? commitFrom; + String? createdAt; + int? length; -part 'hitokoto.freezed.dart'; -part 'hitokoto.g.dart'; + HitokotoResponse({ + this.id, + this.uuid, + this.hitokoto, + this.type, + this.from, + this.fromWho, + this.creator, + this.creatorUid, + this.reviewer, + this.commitFrom, + this.createdAt, + this.length, + }); -@freezed -abstract class HitokotoResponse with _$HitokotoResponse { - const factory HitokotoResponse({ - int? id, - String? uuid, - String? hitokoto, - String? type, - String? from, - @JsonKey(name: 'from_who') String? fromWho, - String? creator, - @JsonKey(name: 'creator_uid') int? creatorUid, - int? reviewer, - @JsonKey(name: 'commit_from') String? commitFrom, - @JsonKey(name: 'created_at') String? createdAt, - int? length, - }) = _HitokotoResponse; + HitokotoResponse.fromJson(Map json) { + id = json["id"]; + uuid = json["uuid"]; + hitokoto = json["hitokoto"]; + type = json["type"]; + from = json["from"]; + fromWho = json["from_who"]; + creator = json["creator"]; + creatorUid = json["creator_uid"]; + reviewer = json["reviewer"]; + commitFrom = json["commit_from"]; + createdAt = json["created_at"]; + length = json["length"]; + } - factory HitokotoResponse.fromJson(Map json) => - _$HitokotoResponseFromJson(json); + Map toJson() { + final Map data = {}; + data["id"] = id; + data["uuid"] = uuid; + data["hitokoto"] = hitokoto; + data["type"] = type; + data["from"] = from; + data["from_who"] = fromWho; + data["creator"] = creator; + data["creator_uid"] = creatorUid; + data["reviewer"] = reviewer; + data["commit_from"] = commitFrom; + data["created_at"] = createdAt; + data["length"] = length; + return data; + } } diff --git a/lib/common/models/hitokoto.freezed.dart b/lib/common/models/hitokoto.freezed.dart deleted file mode 100644 index 9d84cfe..0000000 --- a/lib/common/models/hitokoto.freezed.dart +++ /dev/null @@ -1,370 +0,0 @@ -// dart format width=80 -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'hitokoto.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$HitokotoResponse { - - int? get id; - - String? get uuid; - - String? get hitokoto; - - String? get type; - - String? get from; - - @JsonKey(name: 'from_who') String? get fromWho; - - String? get creator; - - @JsonKey(name: 'creator_uid') int? get creatorUid; - - int? get reviewer; - - @JsonKey(name: 'commit_from') String? get commitFrom; - - @JsonKey(name: 'created_at') String? get createdAt; - - int? get length; - - /// Create a copy of HitokotoResponse - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $HitokotoResponseCopyWith get copyWith => - _$HitokotoResponseCopyWithImpl( - this as HitokotoResponse, _$identity); - - /// Serializes this HitokotoResponse to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is HitokotoResponse && - (identical(other.id, id) || other.id == id) && - (identical(other.uuid, uuid) || other.uuid == uuid) && - (identical(other.hitokoto, hitokoto) || - other.hitokoto == hitokoto) && - (identical(other.type, type) || other.type == type) && - (identical(other.from, from) || other.from == from) && - (identical(other.fromWho, fromWho) || other.fromWho == fromWho) && - (identical(other.creator, creator) || other.creator == creator) && - (identical(other.creatorUid, creatorUid) || - other.creatorUid == creatorUid) && - (identical(other.reviewer, reviewer) || - other.reviewer == reviewer) && - (identical(other.commitFrom, commitFrom) || - other.commitFrom == commitFrom) && - (identical(other.createdAt, createdAt) || - other.createdAt == createdAt) && - (identical(other.length, length) || other.length == length)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, - id, - uuid, - hitokoto, - type, - from, - fromWho, - creator, - creatorUid, - reviewer, - commitFrom, - createdAt, - length); - - @override - String toString() { - return 'HitokotoResponse(id: $id, uuid: $uuid, hitokoto: $hitokoto, type: $type, from: $from, fromWho: $fromWho, creator: $creator, creatorUid: $creatorUid, reviewer: $reviewer, commitFrom: $commitFrom, createdAt: $createdAt, length: $length)'; - } - - -} - -/// @nodoc -abstract mixin class $HitokotoResponseCopyWith<$Res> { - factory $HitokotoResponseCopyWith(HitokotoResponse value, - $Res Function(HitokotoResponse) _then) = _$HitokotoResponseCopyWithImpl; - - @useResult - $Res call({ - int? id, String? uuid, String? hitokoto, String? type, String? from, @JsonKey( - name: 'from_who') String? fromWho, String? creator, @JsonKey( - name: 'creator_uid') int? creatorUid, int? reviewer, @JsonKey( - name: 'commit_from') String? commitFrom, @JsonKey( - name: 'created_at') String? createdAt, int? length - }); - - -} - -/// @nodoc -class _$HitokotoResponseCopyWithImpl<$Res> - implements $HitokotoResponseCopyWith<$Res> { - _$HitokotoResponseCopyWithImpl(this._self, this._then); - - final HitokotoResponse _self; - final $Res Function(HitokotoResponse) _then; - - /// Create a copy of HitokotoResponse - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? id = freezed, Object? uuid = freezed, Object? hitokoto = freezed, Object? type = freezed, Object? from = freezed, Object? fromWho = freezed, Object? creator = freezed, Object? creatorUid = freezed, Object? reviewer = freezed, Object? commitFrom = freezed, Object? createdAt = freezed, Object? length = freezed,}) { - return _then(_self.copyWith( - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as int?, - uuid: freezed == uuid - ? _self.uuid - : uuid // ignore: cast_nullable_to_non_nullable - as String?, - hitokoto: freezed == hitokoto - ? _self.hitokoto - : hitokoto // ignore: cast_nullable_to_non_nullable - as String?, - type: freezed == type - ? _self.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - from: freezed == from - ? _self.from - : from // ignore: cast_nullable_to_non_nullable - as String?, - fromWho: freezed == fromWho - ? _self.fromWho - : fromWho // ignore: cast_nullable_to_non_nullable - as String?, - creator: freezed == creator - ? _self.creator - : creator // ignore: cast_nullable_to_non_nullable - as String?, - creatorUid: freezed == creatorUid - ? _self.creatorUid - : creatorUid // ignore: cast_nullable_to_non_nullable - as int?, - reviewer: freezed == reviewer - ? _self.reviewer - : reviewer // ignore: cast_nullable_to_non_nullable - as int?, - commitFrom: freezed == commitFrom - ? _self.commitFrom - : commitFrom // ignore: cast_nullable_to_non_nullable - as String?, - createdAt: freezed == createdAt - ? _self.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as String?, - length: freezed == length - ? _self.length - : length // ignore: cast_nullable_to_non_nullable - as int?, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _HitokotoResponse implements HitokotoResponse { - const _HitokotoResponse( - {this.id, this.uuid, this.hitokoto, this.type, this.from, @JsonKey( - name: 'from_who') this.fromWho, this.creator, @JsonKey( - name: 'creator_uid') this.creatorUid, this.reviewer, @JsonKey( - name: 'commit_from') this.commitFrom, @JsonKey( - name: 'created_at') this.createdAt, this.length}); - - factory _HitokotoResponse.fromJson(Map json) => - _$HitokotoResponseFromJson(json); - - @override final int? id; - @override final String? uuid; - @override final String? hitokoto; - @override final String? type; - @override final String? from; - @override - @JsonKey(name: 'from_who') - final String? fromWho; - @override final String? creator; - @override - @JsonKey(name: 'creator_uid') - final int? creatorUid; - @override final int? reviewer; - @override - @JsonKey(name: 'commit_from') - final String? commitFrom; - @override - @JsonKey(name: 'created_at') - final String? createdAt; - @override final int? length; - - /// Create a copy of HitokotoResponse - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$HitokotoResponseCopyWith<_HitokotoResponse> get copyWith => - __$HitokotoResponseCopyWithImpl<_HitokotoResponse>(this, _$identity); - - @override - Map toJson() { - return _$HitokotoResponseToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _HitokotoResponse && - (identical(other.id, id) || other.id == id) && - (identical(other.uuid, uuid) || other.uuid == uuid) && - (identical(other.hitokoto, hitokoto) || - other.hitokoto == hitokoto) && - (identical(other.type, type) || other.type == type) && - (identical(other.from, from) || other.from == from) && - (identical(other.fromWho, fromWho) || other.fromWho == fromWho) && - (identical(other.creator, creator) || other.creator == creator) && - (identical(other.creatorUid, creatorUid) || - other.creatorUid == creatorUid) && - (identical(other.reviewer, reviewer) || - other.reviewer == reviewer) && - (identical(other.commitFrom, commitFrom) || - other.commitFrom == commitFrom) && - (identical(other.createdAt, createdAt) || - other.createdAt == createdAt) && - (identical(other.length, length) || other.length == length)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, - id, - uuid, - hitokoto, - type, - from, - fromWho, - creator, - creatorUid, - reviewer, - commitFrom, - createdAt, - length); - - @override - String toString() { - return 'HitokotoResponse(id: $id, uuid: $uuid, hitokoto: $hitokoto, type: $type, from: $from, fromWho: $fromWho, creator: $creator, creatorUid: $creatorUid, reviewer: $reviewer, commitFrom: $commitFrom, createdAt: $createdAt, length: $length)'; - } - - -} - -/// @nodoc -abstract mixin class _$HitokotoResponseCopyWith<$Res> - implements $HitokotoResponseCopyWith<$Res> { - factory _$HitokotoResponseCopyWith(_HitokotoResponse value, - $Res Function(_HitokotoResponse) _then) = __$HitokotoResponseCopyWithImpl; - - @override - @useResult - $Res call({ - int? id, String? uuid, String? hitokoto, String? type, String? from, @JsonKey( - name: 'from_who') String? fromWho, String? creator, @JsonKey( - name: 'creator_uid') int? creatorUid, int? reviewer, @JsonKey( - name: 'commit_from') String? commitFrom, @JsonKey( - name: 'created_at') String? createdAt, int? length - }); - - -} - -/// @nodoc -class __$HitokotoResponseCopyWithImpl<$Res> - implements _$HitokotoResponseCopyWith<$Res> { - __$HitokotoResponseCopyWithImpl(this._self, this._then); - - final _HitokotoResponse _self; - final $Res Function(_HitokotoResponse) _then; - - /// Create a copy of HitokotoResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? id = freezed, Object? uuid = freezed, Object? hitokoto = freezed, Object? type = freezed, Object? from = freezed, Object? fromWho = freezed, Object? creator = freezed, Object? creatorUid = freezed, Object? reviewer = freezed, Object? commitFrom = freezed, Object? createdAt = freezed, Object? length = freezed,}) { - return _then(_HitokotoResponse( - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as int?, - uuid: freezed == uuid - ? _self.uuid - : uuid // ignore: cast_nullable_to_non_nullable - as String?, - hitokoto: freezed == hitokoto - ? _self.hitokoto - : hitokoto // ignore: cast_nullable_to_non_nullable - as String?, - type: freezed == type - ? _self.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - from: freezed == from - ? _self.from - : from // ignore: cast_nullable_to_non_nullable - as String?, - fromWho: freezed == fromWho - ? _self.fromWho - : fromWho // ignore: cast_nullable_to_non_nullable - as String?, - creator: freezed == creator - ? _self.creator - : creator // ignore: cast_nullable_to_non_nullable - as String?, - creatorUid: freezed == creatorUid - ? _self.creatorUid - : creatorUid // ignore: cast_nullable_to_non_nullable - as int?, - reviewer: freezed == reviewer - ? _self.reviewer - : reviewer // ignore: cast_nullable_to_non_nullable - as int?, - commitFrom: freezed == commitFrom - ? _self.commitFrom - : commitFrom // ignore: cast_nullable_to_non_nullable - as String?, - createdAt: freezed == createdAt - ? _self.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as String?, - length: freezed == length - ? _self.length - : length // ignore: cast_nullable_to_non_nullable - as int?, - )); - } - - -} - -// dart format on diff --git a/lib/common/models/hitokoto.g.dart b/lib/common/models/hitokoto.g.dart deleted file mode 100644 index 2b59034..0000000 --- a/lib/common/models/hitokoto.g.dart +++ /dev/null @@ -1,39 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'hitokoto.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_HitokotoResponse _$HitokotoResponseFromJson(Map json) => - _HitokotoResponse( - id: (json['id'] as num?)?.toInt(), - uuid: json['uuid'] as String?, - hitokoto: json['hitokoto'] as String?, - type: json['type'] as String?, - from: json['from'] as String?, - fromWho: json['from_who'] as String?, - creator: json['creator'] as String?, - creatorUid: (json['creator_uid'] as num?)?.toInt(), - reviewer: (json['reviewer'] as num?)?.toInt(), - commitFrom: json['commit_from'] as String?, - createdAt: json['created_at'] as String?, - length: (json['length'] as num?)?.toInt(), - ); - -Map _$HitokotoResponseToJson(_HitokotoResponse instance) => - { - if (instance.id case final value?) 'id': value, - if (instance.uuid case final value?) 'uuid': value, - if (instance.hitokoto case final value?) 'hitokoto': value, - if (instance.type case final value?) 'type': value, - if (instance.from case final value?) 'from': value, - if (instance.fromWho case final value?) 'from_who': value, - if (instance.creator case final value?) 'creator': value, - if (instance.creatorUid case final value?) 'creator_uid': value, - if (instance.reviewer case final value?) 'reviewer': value, - if (instance.commitFrom case final value?) 'commit_from': value, - if (instance.createdAt case final value?) 'created_at': value, - if (instance.length case final value?) 'length': value, - }; diff --git a/lib/common/models/hunyuan.dart b/lib/common/models/hunyuan.dart index f05655e..fddbf83 100644 --- a/lib/common/models/hunyuan.dart +++ b/lib/common/models/hunyuan.dart @@ -1,74 +1,139 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +class PublicHeader { + String? action; + int? timestamp; + String? version; + String? authorization; -part 'hunyuan.freezed.dart'; -part 'hunyuan.g.dart'; + Map toMap() { + return { + 'X-TC-Action': action, + 'X-TC-Timestamp': timestamp, + 'X-TC-Version': version, + 'Authorization': authorization, + }; + } -@freezed -abstract class PublicHeader with _$PublicHeader { - const factory PublicHeader({ - @JsonKey(name: 'X-TC-Action') String? action, - @JsonKey(name: 'X-TC-Timestamp') int? timestamp, - @JsonKey(name: 'X-TC-Version') String? version, - @JsonKey(name: 'Authorization') String? authorization, - }) = _PublicHeader; + PublicHeader.fromMap(Map map) { + action = map['X-TC-Action']; + timestamp = map['X-TC-Timestamp']; + version = map['X-TC-Version']; + authorization = map['Authorization']; + } - factory PublicHeader.fromJson(Map json) => - _$PublicHeaderFromJson(json); + PublicHeader(this.action, this.timestamp, this.version, this.authorization); } -@freezed -abstract class Message with _$Message { - const factory Message({ - @JsonKey(name: 'Role') required String role, - @JsonKey(name: 'Content') required String content, - }) = _Message; +class Message { + late String role; + late String content; - factory Message.fromJson(Map json) => - _$MessageFromJson(json); + Message(this.role, this.content); + + Map toMap() { + return {'Role': role, 'Content': content}; + } + + Message.fromMap(Map map) { + role = map['Role']; + content = map['Content']; + } } -@freezed -abstract class HunyuanResponse with _$HunyuanResponse { - const factory HunyuanResponse({ - @JsonKey(name: 'Note') String? note, - @JsonKey(name: 'Choices') List? choices, - @JsonKey(name: 'Created') int? created, - @JsonKey(name: 'Id') String? id, - @JsonKey(name: 'Usage') Usage? usage, - }) = _HunyuanResponse; +class HunyuanResponse { + String? note; + List? choices; + int? created; + String? id; + Usage? usage; - factory HunyuanResponse.fromJson(Map json) => - _$HunyuanResponseFromJson(json); + HunyuanResponse({this.note, this.choices, this.created, this.id, this.usage}); + + HunyuanResponse.fromJson(Map json) { + note = json["Note"]; + choices = + json["Choices"] == null + ? null + : (json["Choices"] as List) + .map((e) => Choices.fromJson(e)) + .toList(); + created = json["Created"]; + id = json["Id"]; + usage = json["Usage"] == null ? null : Usage.fromJson(json["Usage"]); + } + + Map toJson() { + final Map data = {}; + data["Note"] = note; + if (choices != null) { + data["Choices"] = choices?.map((e) => e.toJson()).toList(); + } + data["Created"] = created; + data["Id"] = id; + if (usage != null) { + data["Usage"] = usage?.toJson(); + } + return data; + } } -@freezed -abstract class Usage with _$Usage { - const factory Usage({ - @JsonKey(name: 'PromptTokens') int? promptTokens, - @JsonKey(name: 'CompletionTokens') int? completionTokens, - @JsonKey(name: 'TotalTokens') int? totalTokens, - }) = _Usage; +class Usage { + int? promptTokens; + int? completionTokens; + int? totalTokens; - factory Usage.fromJson(Map json) => _$UsageFromJson(json); + Usage({this.promptTokens, this.completionTokens, this.totalTokens}); + + Usage.fromJson(Map json) { + promptTokens = json["PromptTokens"]; + completionTokens = json["CompletionTokens"]; + totalTokens = json["TotalTokens"]; + } + + Map toJson() { + final Map data = {}; + data["PromptTokens"] = promptTokens; + data["CompletionTokens"] = completionTokens; + data["TotalTokens"] = totalTokens; + return data; + } } -@freezed -abstract class Choices with _$Choices { - const factory Choices({ - @JsonKey(name: 'FinishReason') String? finishReason, - @JsonKey(name: 'Delta') Delta? delta, - }) = _Choices; +class Choices { + String? finishReason; + Delta? delta; - factory Choices.fromJson(Map json) => - _$ChoicesFromJson(json); + Choices({this.finishReason, this.delta}); + + Choices.fromJson(Map json) { + finishReason = json["FinishReason"]; + delta = json["Delta"] == null ? null : Delta.fromJson(json["Delta"]); + } + + Map toJson() { + final Map data = {}; + data["FinishReason"] = finishReason; + if (delta != null) { + data["Delta"] = delta?.toJson(); + } + return data; + } } -@freezed -abstract class Delta with _$Delta { - const factory Delta({ - @JsonKey(name: 'Role') String? role, - @JsonKey(name: 'Content') String? content, - }) = _Delta; +class Delta { + String? role; + String? content; - factory Delta.fromJson(Map json) => _$DeltaFromJson(json); + Delta({this.role, this.content}); + + Delta.fromJson(Map json) { + role = json["Role"]; + content = json["Content"]; + } + + Map toJson() { + final Map data = {}; + data["Role"] = role; + data["Content"] = content; + return data; + } } diff --git a/lib/common/models/hunyuan.freezed.dart b/lib/common/models/hunyuan.freezed.dart deleted file mode 100644 index ea8215b..0000000 --- a/lib/common/models/hunyuan.freezed.dart +++ /dev/null @@ -1,1250 +0,0 @@ -// dart format width=80 -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'hunyuan.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$PublicHeader { - - @JsonKey(name: 'X-TC-Action') String? get action; - - @JsonKey(name: 'X-TC-Timestamp') int? get timestamp; - - @JsonKey(name: 'X-TC-Version') String? get version; - - @JsonKey(name: 'Authorization') String? get authorization; - - /// Create a copy of PublicHeader - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $PublicHeaderCopyWith get copyWith => - _$PublicHeaderCopyWithImpl( - this as PublicHeader, _$identity); - - /// Serializes this PublicHeader to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is PublicHeader && - (identical(other.action, action) || other.action == action) && - (identical(other.timestamp, timestamp) || - other.timestamp == timestamp) && - (identical(other.version, version) || other.version == version) && - (identical(other.authorization, authorization) || - other.authorization == authorization)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, action, timestamp, version, authorization); - - @override - String toString() { - return 'PublicHeader(action: $action, timestamp: $timestamp, version: $version, authorization: $authorization)'; - } - - -} - -/// @nodoc -abstract mixin class $PublicHeaderCopyWith<$Res> { - factory $PublicHeaderCopyWith(PublicHeader value, - $Res Function(PublicHeader) _then) = _$PublicHeaderCopyWithImpl; - - @useResult - $Res call({ - @JsonKey(name: 'X-TC-Action') String? action, @JsonKey( - name: 'X-TC-Timestamp') int? timestamp, @JsonKey( - name: 'X-TC-Version') String? version, @JsonKey( - name: 'Authorization') String? authorization - }); - - -} - -/// @nodoc -class _$PublicHeaderCopyWithImpl<$Res> - implements $PublicHeaderCopyWith<$Res> { - _$PublicHeaderCopyWithImpl(this._self, this._then); - - final PublicHeader _self; - final $Res Function(PublicHeader) _then; - - /// Create a copy of PublicHeader - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? action = freezed, Object? timestamp = freezed, Object? version = freezed, Object? authorization = freezed,}) { - return _then(_self.copyWith( - action: freezed == action - ? _self.action - : action // ignore: cast_nullable_to_non_nullable - as String?, - timestamp: freezed == timestamp - ? _self.timestamp - : timestamp // ignore: cast_nullable_to_non_nullable - as int?, - version: freezed == version - ? _self.version - : version // ignore: cast_nullable_to_non_nullable - as String?, - authorization: freezed == authorization - ? _self.authorization - : authorization // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _PublicHeader implements PublicHeader { - const _PublicHeader({@JsonKey(name: 'X-TC-Action') this.action, @JsonKey( - name: 'X-TC-Timestamp') this.timestamp, @JsonKey( - name: 'X-TC-Version') this.version, @JsonKey( - name: 'Authorization') this.authorization}); - - factory _PublicHeader.fromJson(Map json) => - _$PublicHeaderFromJson(json); - - @override - @JsonKey(name: 'X-TC-Action') - final String? action; - @override - @JsonKey(name: 'X-TC-Timestamp') - final int? timestamp; - @override - @JsonKey(name: 'X-TC-Version') - final String? version; - @override - @JsonKey(name: 'Authorization') - final String? authorization; - - /// Create a copy of PublicHeader - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$PublicHeaderCopyWith<_PublicHeader> get copyWith => - __$PublicHeaderCopyWithImpl<_PublicHeader>(this, _$identity); - - @override - Map toJson() { - return _$PublicHeaderToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _PublicHeader && - (identical(other.action, action) || other.action == action) && - (identical(other.timestamp, timestamp) || - other.timestamp == timestamp) && - (identical(other.version, version) || other.version == version) && - (identical(other.authorization, authorization) || - other.authorization == authorization)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, action, timestamp, version, authorization); - - @override - String toString() { - return 'PublicHeader(action: $action, timestamp: $timestamp, version: $version, authorization: $authorization)'; - } - - -} - -/// @nodoc -abstract mixin class _$PublicHeaderCopyWith<$Res> - implements $PublicHeaderCopyWith<$Res> { - factory _$PublicHeaderCopyWith(_PublicHeader value, - $Res Function(_PublicHeader) _then) = __$PublicHeaderCopyWithImpl; - - @override - @useResult - $Res call({ - @JsonKey(name: 'X-TC-Action') String? action, @JsonKey( - name: 'X-TC-Timestamp') int? timestamp, @JsonKey( - name: 'X-TC-Version') String? version, @JsonKey( - name: 'Authorization') String? authorization - }); - - -} - -/// @nodoc -class __$PublicHeaderCopyWithImpl<$Res> - implements _$PublicHeaderCopyWith<$Res> { - __$PublicHeaderCopyWithImpl(this._self, this._then); - - final _PublicHeader _self; - final $Res Function(_PublicHeader) _then; - - /// Create a copy of PublicHeader - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? action = freezed, Object? timestamp = freezed, Object? version = freezed, Object? authorization = freezed,}) { - return _then(_PublicHeader( - action: freezed == action - ? _self.action - : action // ignore: cast_nullable_to_non_nullable - as String?, - timestamp: freezed == timestamp - ? _self.timestamp - : timestamp // ignore: cast_nullable_to_non_nullable - as int?, - version: freezed == version - ? _self.version - : version // ignore: cast_nullable_to_non_nullable - as String?, - authorization: freezed == authorization - ? _self.authorization - : authorization // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - - -} - - -/// @nodoc -mixin _$Message { - - @JsonKey(name: 'Role') String get role; - - @JsonKey(name: 'Content') String get content; - - /// Create a copy of Message - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $MessageCopyWith get copyWith => - _$MessageCopyWithImpl(this as Message, _$identity); - - /// Serializes this Message to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Message && - (identical(other.role, role) || other.role == role) && - (identical(other.content, content) || other.content == content)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, role, content); - - @override - String toString() { - return 'Message(role: $role, content: $content)'; - } - - -} - -/// @nodoc -abstract mixin class $MessageCopyWith<$Res> { - factory $MessageCopyWith(Message value, - $Res Function(Message) _then) = _$MessageCopyWithImpl; - - @useResult - $Res call({ - @JsonKey(name: 'Role') String role, @JsonKey(name: 'Content') String content - }); - - -} - -/// @nodoc -class _$MessageCopyWithImpl<$Res> - implements $MessageCopyWith<$Res> { - _$MessageCopyWithImpl(this._self, this._then); - - final Message _self; - final $Res Function(Message) _then; - - /// Create a copy of Message - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({Object? role = null, Object? content = null,}) { - return _then(_self.copyWith( - role: null == role - ? _self.role - : role // ignore: cast_nullable_to_non_nullable - as String, - content: null == content - ? _self.content - : content // ignore: cast_nullable_to_non_nullable - as String, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _Message implements Message { - const _Message({@JsonKey(name: 'Role') required this.role, @JsonKey( - name: 'Content') required this.content}); - - factory _Message.fromJson(Map json) => - _$MessageFromJson(json); - - @override - @JsonKey(name: 'Role') - final String role; - @override - @JsonKey(name: 'Content') - final String content; - - /// Create a copy of Message - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$MessageCopyWith<_Message> get copyWith => - __$MessageCopyWithImpl<_Message>(this, _$identity); - - @override - Map toJson() { - return _$MessageToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Message && - (identical(other.role, role) || other.role == role) && - (identical(other.content, content) || other.content == content)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, role, content); - - @override - String toString() { - return 'Message(role: $role, content: $content)'; - } - - -} - -/// @nodoc -abstract mixin class _$MessageCopyWith<$Res> implements $MessageCopyWith<$Res> { - factory _$MessageCopyWith(_Message value, - $Res Function(_Message) _then) = __$MessageCopyWithImpl; - - @override - @useResult - $Res call({ - @JsonKey(name: 'Role') String role, @JsonKey(name: 'Content') String content - }); - - -} - -/// @nodoc -class __$MessageCopyWithImpl<$Res> - implements _$MessageCopyWith<$Res> { - __$MessageCopyWithImpl(this._self, this._then); - - final _Message _self; - final $Res Function(_Message) _then; - - /// Create a copy of Message - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({Object? role = null, Object? content = null,}) { - return _then(_Message( - role: null == role - ? _self.role - : role // ignore: cast_nullable_to_non_nullable - as String, - content: null == content - ? _self.content - : content // ignore: cast_nullable_to_non_nullable - as String, - )); - } - - -} - - -/// @nodoc -mixin _$HunyuanResponse { - - @JsonKey(name: 'Note') String? get note; - - @JsonKey(name: 'Choices') List? get choices; - - @JsonKey(name: 'Created') int? get created; - - @JsonKey(name: 'Id') String? get id; - - @JsonKey(name: 'Usage') Usage? get usage; - - /// Create a copy of HunyuanResponse - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $HunyuanResponseCopyWith get copyWith => - _$HunyuanResponseCopyWithImpl( - this as HunyuanResponse, _$identity); - - /// Serializes this HunyuanResponse to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is HunyuanResponse && - (identical(other.note, note) || other.note == note) && - const DeepCollectionEquality().equals(other.choices, choices) && - (identical(other.created, created) || other.created == created) && - (identical(other.id, id) || other.id == id) && - (identical(other.usage, usage) || other.usage == usage)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, note, const DeepCollectionEquality().hash(choices), - created, - id, usage); - - @override - String toString() { - return 'HunyuanResponse(note: $note, choices: $choices, created: $created, id: $id, usage: $usage)'; - } - - -} - -/// @nodoc -abstract mixin class $HunyuanResponseCopyWith<$Res> { - factory $HunyuanResponseCopyWith(HunyuanResponse value, - $Res Function(HunyuanResponse) _then) = _$HunyuanResponseCopyWithImpl; - - @useResult - $Res call({ - @JsonKey(name: 'Note') String? note, @JsonKey(name: 'Choices') List< - Choices>? choices, @JsonKey(name: 'Created') int? created, @JsonKey( - name: 'Id') String? id, @JsonKey(name: 'Usage') Usage? usage - }); - - - $UsageCopyWith<$Res>? get usage; - -} - -/// @nodoc -class _$HunyuanResponseCopyWithImpl<$Res> - implements $HunyuanResponseCopyWith<$Res> { - _$HunyuanResponseCopyWithImpl(this._self, this._then); - - final HunyuanResponse _self; - final $Res Function(HunyuanResponse) _then; - - /// Create a copy of HunyuanResponse - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? note = freezed, Object? choices = freezed, Object? created = freezed, Object? id = freezed, Object? usage = freezed,}) { - return _then(_self.copyWith( - note: freezed == note - ? _self.note - : note // ignore: cast_nullable_to_non_nullable - as String?, - choices: freezed == choices - ? _self.choices - : choices // ignore: cast_nullable_to_non_nullable - as List?, - created: freezed == created - ? _self.created - : created // ignore: cast_nullable_to_non_nullable - as int?, - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as String?, - usage: freezed == usage - ? _self.usage - : usage // ignore: cast_nullable_to_non_nullable - as Usage?, - )); - } - - /// Create a copy of HunyuanResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $UsageCopyWith<$Res>? get usage { - if (_self.usage == null) { - return null; - } - - return $UsageCopyWith<$Res>(_self.usage!, (value) { - return _then(_self.copyWith(usage: value)); - }); - } -} - - -/// @nodoc -@JsonSerializable() -class _HunyuanResponse implements HunyuanResponse { - const _HunyuanResponse( - {@JsonKey(name: 'Note') this.note, @JsonKey(name: 'Choices') final List< - Choices>? choices, @JsonKey(name: 'Created') this.created, @JsonKey( - name: 'Id') this.id, @JsonKey(name: 'Usage') this.usage}) - : _choices = choices; - - factory _HunyuanResponse.fromJson(Map json) => - _$HunyuanResponseFromJson(json); - - @override - @JsonKey(name: 'Note') - final String? note; - final List? _choices; - - @override - @JsonKey(name: 'Choices') - List? get choices { - final value = _choices; - if (value == null) return null; - if (_choices is EqualUnmodifiableListView) return _choices; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - @JsonKey(name: 'Created') - final int? created; - @override - @JsonKey(name: 'Id') - final String? id; - @override - @JsonKey(name: 'Usage') - final Usage? usage; - - /// Create a copy of HunyuanResponse - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$HunyuanResponseCopyWith<_HunyuanResponse> get copyWith => - __$HunyuanResponseCopyWithImpl<_HunyuanResponse>(this, _$identity); - - @override - Map toJson() { - return _$HunyuanResponseToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _HunyuanResponse && - (identical(other.note, note) || other.note == note) && - const DeepCollectionEquality().equals(other._choices, _choices) && - (identical(other.created, created) || other.created == created) && - (identical(other.id, id) || other.id == id) && - (identical(other.usage, usage) || other.usage == usage)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, note, const DeepCollectionEquality().hash(_choices), - created, - id, usage); - - @override - String toString() { - return 'HunyuanResponse(note: $note, choices: $choices, created: $created, id: $id, usage: $usage)'; - } - - -} - -/// @nodoc -abstract mixin class _$HunyuanResponseCopyWith<$Res> - implements $HunyuanResponseCopyWith<$Res> { - factory _$HunyuanResponseCopyWith(_HunyuanResponse value, - $Res Function(_HunyuanResponse) _then) = __$HunyuanResponseCopyWithImpl; - - @override - @useResult - $Res call({ - @JsonKey(name: 'Note') String? note, @JsonKey(name: 'Choices') List< - Choices>? choices, @JsonKey(name: 'Created') int? created, @JsonKey( - name: 'Id') String? id, @JsonKey(name: 'Usage') Usage? usage - }); - - - @override $UsageCopyWith<$Res>? get usage; - -} - -/// @nodoc -class __$HunyuanResponseCopyWithImpl<$Res> - implements _$HunyuanResponseCopyWith<$Res> { - __$HunyuanResponseCopyWithImpl(this._self, this._then); - - final _HunyuanResponse _self; - final $Res Function(_HunyuanResponse) _then; - - /// Create a copy of HunyuanResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? note = freezed, Object? choices = freezed, Object? created = freezed, Object? id = freezed, Object? usage = freezed,}) { - return _then(_HunyuanResponse( - note: freezed == note - ? _self.note - : note // ignore: cast_nullable_to_non_nullable - as String?, - choices: freezed == choices - ? _self._choices - : choices // ignore: cast_nullable_to_non_nullable - as List?, - created: freezed == created - ? _self.created - : created // ignore: cast_nullable_to_non_nullable - as int?, - id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable - as String?, - usage: freezed == usage - ? _self.usage - : usage // ignore: cast_nullable_to_non_nullable - as Usage?, - )); - } - - /// Create a copy of HunyuanResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $UsageCopyWith<$Res>? get usage { - if (_self.usage == null) { - return null; - } - - return $UsageCopyWith<$Res>(_self.usage!, (value) { - return _then(_self.copyWith(usage: value)); - }); - } -} - - -/// @nodoc -mixin _$Usage { - - @JsonKey(name: 'PromptTokens') int? get promptTokens; - - @JsonKey(name: 'CompletionTokens') int? get completionTokens; - - @JsonKey(name: 'TotalTokens') int? get totalTokens; - - /// Create a copy of Usage - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $UsageCopyWith get copyWith => - _$UsageCopyWithImpl(this as Usage, _$identity); - - /// Serializes this Usage to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Usage && - (identical(other.promptTokens, promptTokens) || - other.promptTokens == promptTokens) && - (identical(other.completionTokens, completionTokens) || - other.completionTokens == completionTokens) && - (identical(other.totalTokens, totalTokens) || - other.totalTokens == totalTokens)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, promptTokens, completionTokens, totalTokens); - - @override - String toString() { - return 'Usage(promptTokens: $promptTokens, completionTokens: $completionTokens, totalTokens: $totalTokens)'; - } - - -} - -/// @nodoc -abstract mixin class $UsageCopyWith<$Res> { - factory $UsageCopyWith(Usage value, - $Res Function(Usage) _then) = _$UsageCopyWithImpl; - - @useResult - $Res call({ - @JsonKey(name: 'PromptTokens') int? promptTokens, @JsonKey( - name: 'CompletionTokens') int? completionTokens, @JsonKey( - name: 'TotalTokens') int? totalTokens - }); - - -} - -/// @nodoc -class _$UsageCopyWithImpl<$Res> - implements $UsageCopyWith<$Res> { - _$UsageCopyWithImpl(this._self, this._then); - - final Usage _self; - final $Res Function(Usage) _then; - - /// Create a copy of Usage - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? promptTokens = freezed, Object? completionTokens = freezed, Object? totalTokens = freezed,}) { - return _then(_self.copyWith( - promptTokens: freezed == promptTokens - ? _self.promptTokens - : promptTokens // ignore: cast_nullable_to_non_nullable - as int?, - completionTokens: freezed == completionTokens - ? _self.completionTokens - : completionTokens // ignore: cast_nullable_to_non_nullable - as int?, - totalTokens: freezed == totalTokens - ? _self.totalTokens - : totalTokens // ignore: cast_nullable_to_non_nullable - as int?, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _Usage implements Usage { - const _Usage({@JsonKey(name: 'PromptTokens') this.promptTokens, @JsonKey( - name: 'CompletionTokens') this.completionTokens, @JsonKey( - name: 'TotalTokens') this.totalTokens}); - - factory _Usage.fromJson(Map json) => _$UsageFromJson(json); - - @override - @JsonKey(name: 'PromptTokens') - final int? promptTokens; - @override - @JsonKey(name: 'CompletionTokens') - final int? completionTokens; - @override - @JsonKey(name: 'TotalTokens') - final int? totalTokens; - - /// Create a copy of Usage - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$UsageCopyWith<_Usage> get copyWith => - __$UsageCopyWithImpl<_Usage>(this, _$identity); - - @override - Map toJson() { - return _$UsageToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Usage && - (identical(other.promptTokens, promptTokens) || - other.promptTokens == promptTokens) && - (identical(other.completionTokens, completionTokens) || - other.completionTokens == completionTokens) && - (identical(other.totalTokens, totalTokens) || - other.totalTokens == totalTokens)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, promptTokens, completionTokens, totalTokens); - - @override - String toString() { - return 'Usage(promptTokens: $promptTokens, completionTokens: $completionTokens, totalTokens: $totalTokens)'; - } - - -} - -/// @nodoc -abstract mixin class _$UsageCopyWith<$Res> implements $UsageCopyWith<$Res> { - factory _$UsageCopyWith(_Usage value, - $Res Function(_Usage) _then) = __$UsageCopyWithImpl; - - @override - @useResult - $Res call({ - @JsonKey(name: 'PromptTokens') int? promptTokens, @JsonKey( - name: 'CompletionTokens') int? completionTokens, @JsonKey( - name: 'TotalTokens') int? totalTokens - }); - - -} - -/// @nodoc -class __$UsageCopyWithImpl<$Res> - implements _$UsageCopyWith<$Res> { - __$UsageCopyWithImpl(this._self, this._then); - - final _Usage _self; - final $Res Function(_Usage) _then; - - /// Create a copy of Usage - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? promptTokens = freezed, Object? completionTokens = freezed, Object? totalTokens = freezed,}) { - return _then(_Usage( - promptTokens: freezed == promptTokens - ? _self.promptTokens - : promptTokens // ignore: cast_nullable_to_non_nullable - as int?, - completionTokens: freezed == completionTokens - ? _self.completionTokens - : completionTokens // ignore: cast_nullable_to_non_nullable - as int?, - totalTokens: freezed == totalTokens - ? _self.totalTokens - : totalTokens // ignore: cast_nullable_to_non_nullable - as int?, - )); - } - - -} - - -/// @nodoc -mixin _$Choices { - - @JsonKey(name: 'FinishReason') String? get finishReason; - - @JsonKey(name: 'Delta') Delta? get delta; - - /// Create a copy of Choices - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $ChoicesCopyWith get copyWith => - _$ChoicesCopyWithImpl(this as Choices, _$identity); - - /// Serializes this Choices to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Choices && - (identical(other.finishReason, finishReason) || - other.finishReason == finishReason) && - (identical(other.delta, delta) || other.delta == delta)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, finishReason, delta); - - @override - String toString() { - return 'Choices(finishReason: $finishReason, delta: $delta)'; - } - - -} - -/// @nodoc -abstract mixin class $ChoicesCopyWith<$Res> { - factory $ChoicesCopyWith(Choices value, - $Res Function(Choices) _then) = _$ChoicesCopyWithImpl; - - @useResult - $Res call({ - @JsonKey(name: 'FinishReason') String? finishReason, @JsonKey( - name: 'Delta') Delta? delta - }); - - - $DeltaCopyWith<$Res>? get delta; - -} - -/// @nodoc -class _$ChoicesCopyWithImpl<$Res> - implements $ChoicesCopyWith<$Res> { - _$ChoicesCopyWithImpl(this._self, this._then); - - final Choices _self; - final $Res Function(Choices) _then; - - /// Create a copy of Choices - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({Object? finishReason = freezed, Object? delta = freezed,}) { - return _then(_self.copyWith( - finishReason: freezed == finishReason - ? _self.finishReason - : finishReason // ignore: cast_nullable_to_non_nullable - as String?, - delta: freezed == delta - ? _self.delta - : delta // ignore: cast_nullable_to_non_nullable - as Delta?, - )); - } - - /// Create a copy of Choices - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $DeltaCopyWith<$Res>? get delta { - if (_self.delta == null) { - return null; - } - - return $DeltaCopyWith<$Res>(_self.delta!, (value) { - return _then(_self.copyWith(delta: value)); - }); - } -} - - -/// @nodoc -@JsonSerializable() -class _Choices implements Choices { - const _Choices({@JsonKey(name: 'FinishReason') this.finishReason, @JsonKey( - name: 'Delta') this.delta}); - - factory _Choices.fromJson(Map json) => - _$ChoicesFromJson(json); - - @override - @JsonKey(name: 'FinishReason') - final String? finishReason; - @override - @JsonKey(name: 'Delta') - final Delta? delta; - - /// Create a copy of Choices - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$ChoicesCopyWith<_Choices> get copyWith => - __$ChoicesCopyWithImpl<_Choices>(this, _$identity); - - @override - Map toJson() { - return _$ChoicesToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Choices && - (identical(other.finishReason, finishReason) || - other.finishReason == finishReason) && - (identical(other.delta, delta) || other.delta == delta)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, finishReason, delta); - - @override - String toString() { - return 'Choices(finishReason: $finishReason, delta: $delta)'; - } - - -} - -/// @nodoc -abstract mixin class _$ChoicesCopyWith<$Res> implements $ChoicesCopyWith<$Res> { - factory _$ChoicesCopyWith(_Choices value, - $Res Function(_Choices) _then) = __$ChoicesCopyWithImpl; - - @override - @useResult - $Res call({ - @JsonKey(name: 'FinishReason') String? finishReason, @JsonKey( - name: 'Delta') Delta? delta - }); - - - @override $DeltaCopyWith<$Res>? get delta; - -} - -/// @nodoc -class __$ChoicesCopyWithImpl<$Res> - implements _$ChoicesCopyWith<$Res> { - __$ChoicesCopyWithImpl(this._self, this._then); - - final _Choices _self; - final $Res Function(_Choices) _then; - - /// Create a copy of Choices - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({Object? finishReason = freezed, Object? delta = freezed,}) { - return _then(_Choices( - finishReason: freezed == finishReason - ? _self.finishReason - : finishReason // ignore: cast_nullable_to_non_nullable - as String?, - delta: freezed == delta - ? _self.delta - : delta // ignore: cast_nullable_to_non_nullable - as Delta?, - )); - } - - /// Create a copy of Choices - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $DeltaCopyWith<$Res>? get delta { - if (_self.delta == null) { - return null; - } - - return $DeltaCopyWith<$Res>(_self.delta!, (value) { - return _then(_self.copyWith(delta: value)); - }); - } -} - - -/// @nodoc -mixin _$Delta { - - @JsonKey(name: 'Role') String? get role; - - @JsonKey(name: 'Content') String? get content; - - /// Create a copy of Delta - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $DeltaCopyWith get copyWith => - _$DeltaCopyWithImpl(this as Delta, _$identity); - - /// Serializes this Delta to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Delta && - (identical(other.role, role) || other.role == role) && - (identical(other.content, content) || other.content == content)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, role, content); - - @override - String toString() { - return 'Delta(role: $role, content: $content)'; - } - - -} - -/// @nodoc -abstract mixin class $DeltaCopyWith<$Res> { - factory $DeltaCopyWith(Delta value, - $Res Function(Delta) _then) = _$DeltaCopyWithImpl; - - @useResult - $Res call({ - @JsonKey(name: 'Role') String? role, @JsonKey( - name: 'Content') String? content - }); - - -} - -/// @nodoc -class _$DeltaCopyWithImpl<$Res> - implements $DeltaCopyWith<$Res> { - _$DeltaCopyWithImpl(this._self, this._then); - - final Delta _self; - final $Res Function(Delta) _then; - - /// Create a copy of Delta - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({Object? role = freezed, Object? content = freezed,}) { - return _then(_self.copyWith( - role: freezed == role - ? _self.role - : role // ignore: cast_nullable_to_non_nullable - as String?, - content: freezed == content - ? _self.content - : content // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _Delta implements Delta { - const _Delta({@JsonKey(name: 'Role') this.role, @JsonKey( - name: 'Content') this.content}); - - factory _Delta.fromJson(Map json) => _$DeltaFromJson(json); - - @override - @JsonKey(name: 'Role') - final String? role; - @override - @JsonKey(name: 'Content') - final String? content; - - /// Create a copy of Delta - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$DeltaCopyWith<_Delta> get copyWith => - __$DeltaCopyWithImpl<_Delta>(this, _$identity); - - @override - Map toJson() { - return _$DeltaToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Delta && - (identical(other.role, role) || other.role == role) && - (identical(other.content, content) || other.content == content)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, role, content); - - @override - String toString() { - return 'Delta(role: $role, content: $content)'; - } - - -} - -/// @nodoc -abstract mixin class _$DeltaCopyWith<$Res> implements $DeltaCopyWith<$Res> { - factory _$DeltaCopyWith(_Delta value, - $Res Function(_Delta) _then) = __$DeltaCopyWithImpl; - - @override - @useResult - $Res call({ - @JsonKey(name: 'Role') String? role, @JsonKey( - name: 'Content') String? content - }); - - -} - -/// @nodoc -class __$DeltaCopyWithImpl<$Res> - implements _$DeltaCopyWith<$Res> { - __$DeltaCopyWithImpl(this._self, this._then); - - final _Delta _self; - final $Res Function(_Delta) _then; - - /// Create a copy of Delta - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({Object? role = freezed, Object? content = freezed,}) { - return _then(_Delta( - role: freezed == role - ? _self.role - : role // ignore: cast_nullable_to_non_nullable - as String?, - content: freezed == content - ? _self.content - : content // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - - -} - -// dart format on diff --git a/lib/common/models/hunyuan.g.dart b/lib/common/models/hunyuan.g.dart deleted file mode 100644 index 82036ef..0000000 --- a/lib/common/models/hunyuan.g.dart +++ /dev/null @@ -1,88 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'hunyuan.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_PublicHeader _$PublicHeaderFromJson(Map json) => - _PublicHeader( - action: json['X-TC-Action'] as String?, - timestamp: (json['X-TC-Timestamp'] as num?)?.toInt(), - version: json['X-TC-Version'] as String?, - authorization: json['Authorization'] as String?, - ); - -Map _$PublicHeaderToJson(_PublicHeader instance) => - { - if (instance.action case final value?) 'X-TC-Action': value, - if (instance.timestamp case final value?) 'X-TC-Timestamp': value, - if (instance.version case final value?) 'X-TC-Version': value, - if (instance.authorization case final value?) 'Authorization': value, - }; - -_Message _$MessageFromJson(Map json) => - _Message(role: json['Role'] as String, content: json['Content'] as String); - -Map _$MessageToJson(_Message instance) => { - 'Role': instance.role, - 'Content': instance.content, -}; - -_HunyuanResponse _$HunyuanResponseFromJson(Map json) => - _HunyuanResponse( - note: json['Note'] as String?, - choices: - (json['Choices'] as List?) - ?.map((e) => Choices.fromJson(e as Map)) - .toList(), - created: (json['Created'] as num?)?.toInt(), - id: json['Id'] as String?, - usage: - json['Usage'] == null - ? null - : Usage.fromJson(json['Usage'] as Map), - ); - -Map _$HunyuanResponseToJson(_HunyuanResponse instance) => - { - if (instance.note case final value?) 'Note': value, - if (instance.choices case final value?) 'Choices': value, - if (instance.created case final value?) 'Created': value, - if (instance.id case final value?) 'Id': value, - if (instance.usage case final value?) 'Usage': value, - }; - -_Usage _$UsageFromJson(Map json) => _Usage( - promptTokens: (json['PromptTokens'] as num?)?.toInt(), - completionTokens: (json['CompletionTokens'] as num?)?.toInt(), - totalTokens: (json['TotalTokens'] as num?)?.toInt(), -); - -Map _$UsageToJson(_Usage instance) => { - if (instance.promptTokens case final value?) 'PromptTokens': value, - if (instance.completionTokens case final value?) 'CompletionTokens': value, - if (instance.totalTokens case final value?) 'TotalTokens': value, -}; - -_Choices _$ChoicesFromJson(Map json) => _Choices( - finishReason: json['FinishReason'] as String?, - delta: - json['Delta'] == null - ? null - : Delta.fromJson(json['Delta'] as Map), -); - -Map _$ChoicesToJson(_Choices instance) => { - if (instance.finishReason case final value?) 'FinishReason': value, - if (instance.delta case final value?) 'Delta': value, -}; - -_Delta _$DeltaFromJson(Map json) => - _Delta(role: json['Role'] as String?, content: json['Content'] as String?); - -Map _$DeltaToJson(_Delta instance) => { - if (instance.role case final value?) 'Role': value, - if (instance.content case final value?) 'Content': value, -}; diff --git a/lib/common/models/image.dart b/lib/common/models/image.dart index 5cd4ecf..f9e0b44 100644 --- a/lib/common/models/image.dart +++ b/lib/common/models/image.dart @@ -1,50 +1,130 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +class BingImage { + List? images; + Tooltips? tooltips; -part 'image.freezed.dart'; -part 'image.g.dart'; + BingImage({this.images, this.tooltips}); -@freezed -abstract class BingImage with _$BingImage { - const factory BingImage({List? images, Tooltips? tooltips}) = - _BingImage; + BingImage.fromJson(Map json) { + images = + json["images"] == null + ? null + : (json["images"] as List).map((e) => Images.fromJson(e)).toList(); + tooltips = + json["tooltips"] == null ? null : Tooltips.fromJson(json["tooltips"]); + } - factory BingImage.fromJson(Map json) => - _$BingImageFromJson(json); + Map toJson() { + final Map data = {}; + if (images != null) { + data["images"] = images?.map((e) => e.toJson()).toList(); + } + if (tooltips != null) { + data["tooltips"] = tooltips?.toJson(); + } + return data; + } } -@freezed -abstract class Tooltips with _$Tooltips { - const factory Tooltips({ - String? loading, - String? previous, - String? next, - String? walle, - String? walls, - }) = _Tooltips; +class Tooltips { + String? loading; + String? previous; + String? next; + String? walle; + String? walls; - factory Tooltips.fromJson(Map json) => - _$TooltipsFromJson(json); + Tooltips({this.loading, this.previous, this.next, this.walle, this.walls}); + + Tooltips.fromJson(Map json) { + loading = json["loading"]; + previous = json["previous"]; + next = json["next"]; + walle = json["walle"]; + walls = json["walls"]; + } + + Map toJson() { + final Map data = {}; + data["loading"] = loading; + data["previous"] = previous; + data["next"] = next; + data["walle"] = walle; + data["walls"] = walls; + return data; + } } -@freezed -abstract class Images with _$Images { - const factory Images({ - String? startdate, - String? fullstartdate, - String? enddate, - String? url, - String? urlbase, - String? copyright, - String? copyrightlink, - String? title, - String? quiz, - bool? wp, - String? hsh, - int? drk, - int? top, - int? bot, - List? hs, - }) = _Images; +class Images { + String? startdate; + String? fullstartdate; + String? enddate; + String? url; + String? urlbase; + String? copyright; + String? copyrightlink; + String? title; + String? quiz; + bool? wp; + String? hsh; + int? drk; + int? top; + int? bot; + List? hs; - factory Images.fromJson(Map json) => _$ImagesFromJson(json); + Images({ + this.startdate, + this.fullstartdate, + this.enddate, + this.url, + this.urlbase, + this.copyright, + this.copyrightlink, + this.title, + this.quiz, + this.wp, + this.hsh, + this.drk, + this.top, + this.bot, + this.hs, + }); + + Images.fromJson(Map json) { + startdate = json["startdate"]; + fullstartdate = json["fullstartdate"]; + enddate = json["enddate"]; + url = json["url"]; + urlbase = json["urlbase"]; + copyright = json["copyright"]; + copyrightlink = json["copyrightlink"]; + title = json["title"]; + quiz = json["quiz"]; + wp = json["wp"]; + hsh = json["hsh"]; + drk = json["drk"]; + top = json["top"]; + bot = json["bot"]; + hs = json["hs"] ?? []; + } + + Map toJson() { + final Map data = {}; + data["startdate"] = startdate; + data["fullstartdate"] = fullstartdate; + data["enddate"] = enddate; + data["url"] = url; + data["urlbase"] = urlbase; + data["copyright"] = copyright; + data["copyrightlink"] = copyrightlink; + data["title"] = title; + data["quiz"] = quiz; + data["wp"] = wp; + data["hsh"] = hsh; + data["drk"] = drk; + data["top"] = top; + data["bot"] = bot; + if (hs != null) { + data["hs"] = hs; + } + return data; + } } diff --git a/lib/common/models/image.freezed.dart b/lib/common/models/image.freezed.dart deleted file mode 100644 index cd5f539..0000000 --- a/lib/common/models/image.freezed.dart +++ /dev/null @@ -1,825 +0,0 @@ -// dart format width=80 -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'image.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$BingImage { - - List? get images; - - Tooltips? get tooltips; - - /// Create a copy of BingImage - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $BingImageCopyWith get copyWith => - _$BingImageCopyWithImpl(this as BingImage, _$identity); - - /// Serializes this BingImage to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is BingImage && - const DeepCollectionEquality().equals(other.images, images) && - (identical(other.tooltips, tooltips) || - other.tooltips == tooltips)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, const DeepCollectionEquality().hash(images), tooltips); - - @override - String toString() { - return 'BingImage(images: $images, tooltips: $tooltips)'; - } - - -} - -/// @nodoc -abstract mixin class $BingImageCopyWith<$Res> { - factory $BingImageCopyWith(BingImage value, - $Res Function(BingImage) _then) = _$BingImageCopyWithImpl; - - @useResult - $Res call({ - List? images, Tooltips? tooltips - }); - - - $TooltipsCopyWith<$Res>? get tooltips; - -} - -/// @nodoc -class _$BingImageCopyWithImpl<$Res> - implements $BingImageCopyWith<$Res> { - _$BingImageCopyWithImpl(this._self, this._then); - - final BingImage _self; - final $Res Function(BingImage) _then; - - /// Create a copy of BingImage - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({Object? images = freezed, Object? tooltips = freezed,}) { - return _then(_self.copyWith( - images: freezed == images - ? _self.images - : images // ignore: cast_nullable_to_non_nullable - as List?, - tooltips: freezed == tooltips - ? _self.tooltips - : tooltips // ignore: cast_nullable_to_non_nullable - as Tooltips?, - )); - } - - /// Create a copy of BingImage - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $TooltipsCopyWith<$Res>? get tooltips { - if (_self.tooltips == null) { - return null; - } - - return $TooltipsCopyWith<$Res>(_self.tooltips!, (value) { - return _then(_self.copyWith(tooltips: value)); - }); - } -} - - -/// @nodoc -@JsonSerializable() -class _BingImage implements BingImage { - const _BingImage({final List? images, this.tooltips}) - : _images = images; - - factory _BingImage.fromJson(Map json) => - _$BingImageFromJson(json); - - final List? _images; - - @override List? get images { - final value = _images; - if (value == null) return null; - if (_images is EqualUnmodifiableListView) return _images; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override final Tooltips? tooltips; - - /// Create a copy of BingImage - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$BingImageCopyWith<_BingImage> get copyWith => - __$BingImageCopyWithImpl<_BingImage>(this, _$identity); - - @override - Map toJson() { - return _$BingImageToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _BingImage && - const DeepCollectionEquality().equals(other._images, _images) && - (identical(other.tooltips, tooltips) || - other.tooltips == tooltips)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, const DeepCollectionEquality().hash(_images), tooltips); - - @override - String toString() { - return 'BingImage(images: $images, tooltips: $tooltips)'; - } - - -} - -/// @nodoc -abstract mixin class _$BingImageCopyWith<$Res> - implements $BingImageCopyWith<$Res> { - factory _$BingImageCopyWith(_BingImage value, - $Res Function(_BingImage) _then) = __$BingImageCopyWithImpl; - - @override - @useResult - $Res call({ - List? images, Tooltips? tooltips - }); - - - @override $TooltipsCopyWith<$Res>? get tooltips; - -} - -/// @nodoc -class __$BingImageCopyWithImpl<$Res> - implements _$BingImageCopyWith<$Res> { - __$BingImageCopyWithImpl(this._self, this._then); - - final _BingImage _self; - final $Res Function(_BingImage) _then; - - /// Create a copy of BingImage - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({Object? images = freezed, Object? tooltips = freezed,}) { - return _then(_BingImage( - images: freezed == images - ? _self._images - : images // ignore: cast_nullable_to_non_nullable - as List?, - tooltips: freezed == tooltips - ? _self.tooltips - : tooltips // ignore: cast_nullable_to_non_nullable - as Tooltips?, - )); - } - - /// Create a copy of BingImage - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $TooltipsCopyWith<$Res>? get tooltips { - if (_self.tooltips == null) { - return null; - } - - return $TooltipsCopyWith<$Res>(_self.tooltips!, (value) { - return _then(_self.copyWith(tooltips: value)); - }); - } -} - - -/// @nodoc -mixin _$Tooltips { - - String? get loading; - - String? get previous; - - String? get next; - - String? get walle; - - String? get walls; - - /// Create a copy of Tooltips - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $TooltipsCopyWith get copyWith => - _$TooltipsCopyWithImpl(this as Tooltips, _$identity); - - /// Serializes this Tooltips to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Tooltips && - (identical(other.loading, loading) || other.loading == loading) && - (identical(other.previous, previous) || - other.previous == previous) && - (identical(other.next, next) || other.next == next) && - (identical(other.walle, walle) || other.walle == walle) && - (identical(other.walls, walls) || other.walls == walls)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, loading, previous, next, walle, walls); - - @override - String toString() { - return 'Tooltips(loading: $loading, previous: $previous, next: $next, walle: $walle, walls: $walls)'; - } - - -} - -/// @nodoc -abstract mixin class $TooltipsCopyWith<$Res> { - factory $TooltipsCopyWith(Tooltips value, - $Res Function(Tooltips) _then) = _$TooltipsCopyWithImpl; - - @useResult - $Res call({ - String? loading, String? previous, String? next, String? walle, String? walls - }); - - -} - -/// @nodoc -class _$TooltipsCopyWithImpl<$Res> - implements $TooltipsCopyWith<$Res> { - _$TooltipsCopyWithImpl(this._self, this._then); - - final Tooltips _self; - final $Res Function(Tooltips) _then; - - /// Create a copy of Tooltips - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? loading = freezed, Object? previous = freezed, Object? next = freezed, Object? walle = freezed, Object? walls = freezed,}) { - return _then(_self.copyWith( - loading: freezed == loading - ? _self.loading - : loading // ignore: cast_nullable_to_non_nullable - as String?, - previous: freezed == previous - ? _self.previous - : previous // ignore: cast_nullable_to_non_nullable - as String?, - next: freezed == next - ? _self.next - : next // ignore: cast_nullable_to_non_nullable - as String?, - walle: freezed == walle - ? _self.walle - : walle // ignore: cast_nullable_to_non_nullable - as String?, - walls: freezed == walls - ? _self.walls - : walls // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _Tooltips implements Tooltips { - const _Tooltips( - {this.loading, this.previous, this.next, this.walle, this.walls}); - - factory _Tooltips.fromJson(Map json) => - _$TooltipsFromJson(json); - - @override final String? loading; - @override final String? previous; - @override final String? next; - @override final String? walle; - @override final String? walls; - - /// Create a copy of Tooltips - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$TooltipsCopyWith<_Tooltips> get copyWith => - __$TooltipsCopyWithImpl<_Tooltips>(this, _$identity); - - @override - Map toJson() { - return _$TooltipsToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Tooltips && - (identical(other.loading, loading) || other.loading == loading) && - (identical(other.previous, previous) || - other.previous == previous) && - (identical(other.next, next) || other.next == next) && - (identical(other.walle, walle) || other.walle == walle) && - (identical(other.walls, walls) || other.walls == walls)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, loading, previous, next, walle, walls); - - @override - String toString() { - return 'Tooltips(loading: $loading, previous: $previous, next: $next, walle: $walle, walls: $walls)'; - } - - -} - -/// @nodoc -abstract mixin class _$TooltipsCopyWith<$Res> - implements $TooltipsCopyWith<$Res> { - factory _$TooltipsCopyWith(_Tooltips value, - $Res Function(_Tooltips) _then) = __$TooltipsCopyWithImpl; - - @override - @useResult - $Res call({ - String? loading, String? previous, String? next, String? walle, String? walls - }); - - -} - -/// @nodoc -class __$TooltipsCopyWithImpl<$Res> - implements _$TooltipsCopyWith<$Res> { - __$TooltipsCopyWithImpl(this._self, this._then); - - final _Tooltips _self; - final $Res Function(_Tooltips) _then; - - /// Create a copy of Tooltips - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? loading = freezed, Object? previous = freezed, Object? next = freezed, Object? walle = freezed, Object? walls = freezed,}) { - return _then(_Tooltips( - loading: freezed == loading - ? _self.loading - : loading // ignore: cast_nullable_to_non_nullable - as String?, - previous: freezed == previous - ? _self.previous - : previous // ignore: cast_nullable_to_non_nullable - as String?, - next: freezed == next - ? _self.next - : next // ignore: cast_nullable_to_non_nullable - as String?, - walle: freezed == walle - ? _self.walle - : walle // ignore: cast_nullable_to_non_nullable - as String?, - walls: freezed == walls - ? _self.walls - : walls // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - - -} - - -/// @nodoc -mixin _$Images { - - String? get startdate; - - String? get fullstartdate; - - String? get enddate; - - String? get url; - - String? get urlbase; - - String? get copyright; - - String? get copyrightlink; - - String? get title; - - String? get quiz; - - bool? get wp; - - String? get hsh; - - int? get drk; - - int? get top; - - int? get bot; - - List? get hs; - - /// Create a copy of Images - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $ImagesCopyWith get copyWith => - _$ImagesCopyWithImpl(this as Images, _$identity); - - /// Serializes this Images to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Images && - (identical(other.startdate, startdate) || - other.startdate == startdate) && - (identical(other.fullstartdate, fullstartdate) || - other.fullstartdate == fullstartdate) && - (identical(other.enddate, enddate) || other.enddate == enddate) && - (identical(other.url, url) || other.url == url) && - (identical(other.urlbase, urlbase) || other.urlbase == urlbase) && - (identical(other.copyright, copyright) || - other.copyright == copyright) && - (identical(other.copyrightlink, copyrightlink) || - other.copyrightlink == copyrightlink) && - (identical(other.title, title) || other.title == title) && - (identical(other.quiz, quiz) || other.quiz == quiz) && - (identical(other.wp, wp) || other.wp == wp) && - (identical(other.hsh, hsh) || other.hsh == hsh) && - (identical(other.drk, drk) || other.drk == drk) && - (identical(other.top, top) || other.top == top) && - (identical(other.bot, bot) || other.bot == bot) && - const DeepCollectionEquality().equals(other.hs, hs)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, - startdate, - fullstartdate, - enddate, - url, - urlbase, - copyright, - copyrightlink, - title, - quiz, - wp, - hsh, - drk, - top, - bot, - const DeepCollectionEquality().hash(hs)); - - @override - String toString() { - return 'Images(startdate: $startdate, fullstartdate: $fullstartdate, enddate: $enddate, url: $url, urlbase: $urlbase, copyright: $copyright, copyrightlink: $copyrightlink, title: $title, quiz: $quiz, wp: $wp, hsh: $hsh, drk: $drk, top: $top, bot: $bot, hs: $hs)'; - } - - -} - -/// @nodoc -abstract mixin class $ImagesCopyWith<$Res> { - factory $ImagesCopyWith(Images value, - $Res Function(Images) _then) = _$ImagesCopyWithImpl; - - @useResult - $Res call({ - String? startdate, String? fullstartdate, String? enddate, String? url, String? urlbase, String? copyright, String? copyrightlink, String? title, String? quiz, bool? wp, String? hsh, int? drk, int? top, int? bot, List< - dynamic>? hs - }); - - -} - -/// @nodoc -class _$ImagesCopyWithImpl<$Res> - implements $ImagesCopyWith<$Res> { - _$ImagesCopyWithImpl(this._self, this._then); - - final Images _self; - final $Res Function(Images) _then; - - /// Create a copy of Images - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? startdate = freezed, Object? fullstartdate = freezed, Object? enddate = freezed, Object? url = freezed, Object? urlbase = freezed, Object? copyright = freezed, Object? copyrightlink = freezed, Object? title = freezed, Object? quiz = freezed, Object? wp = freezed, Object? hsh = freezed, Object? drk = freezed, Object? top = freezed, Object? bot = freezed, Object? hs = freezed,}) { - return _then(_self.copyWith( - startdate: freezed == startdate - ? _self.startdate - : startdate // ignore: cast_nullable_to_non_nullable - as String?, - fullstartdate: freezed == fullstartdate - ? _self.fullstartdate - : fullstartdate // ignore: cast_nullable_to_non_nullable - as String?, - enddate: freezed == enddate - ? _self.enddate - : enddate // ignore: cast_nullable_to_non_nullable - as String?, - url: freezed == url - ? _self.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - urlbase: freezed == urlbase - ? _self.urlbase - : urlbase // ignore: cast_nullable_to_non_nullable - as String?, - copyright: freezed == copyright - ? _self.copyright - : copyright // ignore: cast_nullable_to_non_nullable - as String?, - copyrightlink: freezed == copyrightlink - ? _self.copyrightlink - : copyrightlink // ignore: cast_nullable_to_non_nullable - as String?, - title: freezed == title - ? _self.title - : title // ignore: cast_nullable_to_non_nullable - as String?, - quiz: freezed == quiz - ? _self.quiz - : quiz // ignore: cast_nullable_to_non_nullable - as String?, - wp: freezed == wp ? _self.wp : wp // ignore: cast_nullable_to_non_nullable - as bool?, - hsh: freezed == hsh - ? _self.hsh - : hsh // ignore: cast_nullable_to_non_nullable - as String?, - drk: freezed == drk - ? _self.drk - : drk // ignore: cast_nullable_to_non_nullable - as int?, - top: freezed == top - ? _self.top - : top // ignore: cast_nullable_to_non_nullable - as int?, - bot: freezed == bot - ? _self.bot - : bot // ignore: cast_nullable_to_non_nullable - as int?, - hs: freezed == hs ? _self.hs : hs // ignore: cast_nullable_to_non_nullable - as List?, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _Images implements Images { - const _Images( - {this.startdate, this.fullstartdate, this.enddate, this.url, this.urlbase, this.copyright, this.copyrightlink, this.title, this.quiz, this.wp, this.hsh, this.drk, this.top, this.bot, final List< - dynamic>? hs}) : _hs = hs; - - factory _Images.fromJson(Map json) => _$ImagesFromJson(json); - - @override final String? startdate; - @override final String? fullstartdate; - @override final String? enddate; - @override final String? url; - @override final String? urlbase; - @override final String? copyright; - @override final String? copyrightlink; - @override final String? title; - @override final String? quiz; - @override final bool? wp; - @override final String? hsh; - @override final int? drk; - @override final int? top; - @override final int? bot; - final List? _hs; - - @override List? get hs { - final value = _hs; - if (value == null) return null; - if (_hs is EqualUnmodifiableListView) return _hs; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - - /// Create a copy of Images - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$ImagesCopyWith<_Images> get copyWith => - __$ImagesCopyWithImpl<_Images>(this, _$identity); - - @override - Map toJson() { - return _$ImagesToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Images && - (identical(other.startdate, startdate) || - other.startdate == startdate) && - (identical(other.fullstartdate, fullstartdate) || - other.fullstartdate == fullstartdate) && - (identical(other.enddate, enddate) || other.enddate == enddate) && - (identical(other.url, url) || other.url == url) && - (identical(other.urlbase, urlbase) || other.urlbase == urlbase) && - (identical(other.copyright, copyright) || - other.copyright == copyright) && - (identical(other.copyrightlink, copyrightlink) || - other.copyrightlink == copyrightlink) && - (identical(other.title, title) || other.title == title) && - (identical(other.quiz, quiz) || other.quiz == quiz) && - (identical(other.wp, wp) || other.wp == wp) && - (identical(other.hsh, hsh) || other.hsh == hsh) && - (identical(other.drk, drk) || other.drk == drk) && - (identical(other.top, top) || other.top == top) && - (identical(other.bot, bot) || other.bot == bot) && - const DeepCollectionEquality().equals(other._hs, _hs)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, - startdate, - fullstartdate, - enddate, - url, - urlbase, - copyright, - copyrightlink, - title, - quiz, - wp, - hsh, - drk, - top, - bot, - const DeepCollectionEquality().hash(_hs)); - - @override - String toString() { - return 'Images(startdate: $startdate, fullstartdate: $fullstartdate, enddate: $enddate, url: $url, urlbase: $urlbase, copyright: $copyright, copyrightlink: $copyrightlink, title: $title, quiz: $quiz, wp: $wp, hsh: $hsh, drk: $drk, top: $top, bot: $bot, hs: $hs)'; - } - - -} - -/// @nodoc -abstract mixin class _$ImagesCopyWith<$Res> implements $ImagesCopyWith<$Res> { - factory _$ImagesCopyWith(_Images value, - $Res Function(_Images) _then) = __$ImagesCopyWithImpl; - - @override - @useResult - $Res call({ - String? startdate, String? fullstartdate, String? enddate, String? url, String? urlbase, String? copyright, String? copyrightlink, String? title, String? quiz, bool? wp, String? hsh, int? drk, int? top, int? bot, List< - dynamic>? hs - }); - - -} - -/// @nodoc -class __$ImagesCopyWithImpl<$Res> - implements _$ImagesCopyWith<$Res> { - __$ImagesCopyWithImpl(this._self, this._then); - - final _Images _self; - final $Res Function(_Images) _then; - - /// Create a copy of Images - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? startdate = freezed, Object? fullstartdate = freezed, Object? enddate = freezed, Object? url = freezed, Object? urlbase = freezed, Object? copyright = freezed, Object? copyrightlink = freezed, Object? title = freezed, Object? quiz = freezed, Object? wp = freezed, Object? hsh = freezed, Object? drk = freezed, Object? top = freezed, Object? bot = freezed, Object? hs = freezed,}) { - return _then(_Images( - startdate: freezed == startdate - ? _self.startdate - : startdate // ignore: cast_nullable_to_non_nullable - as String?, - fullstartdate: freezed == fullstartdate - ? _self.fullstartdate - : fullstartdate // ignore: cast_nullable_to_non_nullable - as String?, - enddate: freezed == enddate - ? _self.enddate - : enddate // ignore: cast_nullable_to_non_nullable - as String?, - url: freezed == url - ? _self.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - urlbase: freezed == urlbase - ? _self.urlbase - : urlbase // ignore: cast_nullable_to_non_nullable - as String?, - copyright: freezed == copyright - ? _self.copyright - : copyright // ignore: cast_nullable_to_non_nullable - as String?, - copyrightlink: freezed == copyrightlink - ? _self.copyrightlink - : copyrightlink // ignore: cast_nullable_to_non_nullable - as String?, - title: freezed == title - ? _self.title - : title // ignore: cast_nullable_to_non_nullable - as String?, - quiz: freezed == quiz - ? _self.quiz - : quiz // ignore: cast_nullable_to_non_nullable - as String?, - wp: freezed == wp ? _self.wp : wp // ignore: cast_nullable_to_non_nullable - as bool?, - hsh: freezed == hsh - ? _self.hsh - : hsh // ignore: cast_nullable_to_non_nullable - as String?, - drk: freezed == drk - ? _self.drk - : drk // ignore: cast_nullable_to_non_nullable - as int?, - top: freezed == top - ? _self.top - : top // ignore: cast_nullable_to_non_nullable - as int?, - bot: freezed == bot - ? _self.bot - : bot // ignore: cast_nullable_to_non_nullable - as int?, - hs: freezed == hs - ? _self._hs - : hs // ignore: cast_nullable_to_non_nullable - as List?, - )); - } - - -} - -// dart format on diff --git a/lib/common/models/image.g.dart b/lib/common/models/image.g.dart deleted file mode 100644 index 234cf41..0000000 --- a/lib/common/models/image.g.dart +++ /dev/null @@ -1,76 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'image.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_BingImage _$BingImageFromJson(Map json) => _BingImage( - images: - (json['images'] as List?) - ?.map((e) => Images.fromJson(e as Map)) - .toList(), - tooltips: - json['tooltips'] == null - ? null - : Tooltips.fromJson(json['tooltips'] as Map), -); - -Map _$BingImageToJson(_BingImage instance) => - { - if (instance.images case final value?) 'images': value, - if (instance.tooltips case final value?) 'tooltips': value, - }; - -_Tooltips _$TooltipsFromJson(Map json) => _Tooltips( - loading: json['loading'] as String?, - previous: json['previous'] as String?, - next: json['next'] as String?, - walle: json['walle'] as String?, - walls: json['walls'] as String?, -); - -Map _$TooltipsToJson(_Tooltips instance) => { - if (instance.loading case final value?) 'loading': value, - if (instance.previous case final value?) 'previous': value, - if (instance.next case final value?) 'next': value, - if (instance.walle case final value?) 'walle': value, - if (instance.walls case final value?) 'walls': value, -}; - -_Images _$ImagesFromJson(Map json) => _Images( - startdate: json['startdate'] as String?, - fullstartdate: json['fullstartdate'] as String?, - enddate: json['enddate'] as String?, - url: json['url'] as String?, - urlbase: json['urlbase'] as String?, - copyright: json['copyright'] as String?, - copyrightlink: json['copyrightlink'] as String?, - title: json['title'] as String?, - quiz: json['quiz'] as String?, - wp: json['wp'] as bool?, - hsh: json['hsh'] as String?, - drk: (json['drk'] as num?)?.toInt(), - top: (json['top'] as num?)?.toInt(), - bot: (json['bot'] as num?)?.toInt(), - hs: json['hs'] as List?, -); - -Map _$ImagesToJson(_Images instance) => { - if (instance.startdate case final value?) 'startdate': value, - if (instance.fullstartdate case final value?) 'fullstartdate': value, - if (instance.enddate case final value?) 'enddate': value, - if (instance.url case final value?) 'url': value, - if (instance.urlbase case final value?) 'urlbase': value, - if (instance.copyright case final value?) 'copyright': value, - if (instance.copyrightlink case final value?) 'copyrightlink': value, - if (instance.title case final value?) 'title': value, - if (instance.quiz case final value?) 'quiz': value, - if (instance.wp case final value?) 'wp': value, - if (instance.hsh case final value?) 'hsh': value, - if (instance.drk case final value?) 'drk': value, - if (instance.top case final value?) 'top': value, - if (instance.bot case final value?) 'bot': value, - if (instance.hs case final value?) 'hs': value, -}; diff --git a/lib/common/models/weather.dart b/lib/common/models/weather.dart index 63b6710..cbf0cea 100644 --- a/lib/common/models/weather.dart +++ b/lib/common/models/weather.dart @@ -1,48 +1,136 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +class WeatherResponse { + String? code; + String? updateTime; + String? fxLink; + Now? now; + Refer? refer; -part 'weather.freezed.dart'; -part 'weather.g.dart'; + WeatherResponse({ + this.code, + this.updateTime, + this.fxLink, + this.now, + this.refer, + }); -@freezed -abstract class WeatherResponse with _$WeatherResponse { - const factory WeatherResponse({ - String? code, - String? updateTime, - String? fxLink, - Now? now, - Refer? refer, - }) = _WeatherResponse; + WeatherResponse.fromJson(Map json) { + code = json["code"]; + updateTime = json["updateTime"]; + fxLink = json["fxLink"]; + now = json["now"] == null ? null : Now.fromJson(json["now"]); + refer = json["refer"] == null ? null : Refer.fromJson(json["refer"]); + } - factory WeatherResponse.fromJson(Map json) => - _$WeatherResponseFromJson(json); + Map toJson() { + final Map data = {}; + data["code"] = code; + data["updateTime"] = updateTime; + data["fxLink"] = fxLink; + if (now != null) { + data["now"] = now?.toJson(); + } + if (refer != null) { + data["refer"] = refer?.toJson(); + } + return data; + } } -@freezed -abstract class Refer with _$Refer { - const factory Refer({List? sources, List? license}) = _Refer; +class Refer { + List? sources; + List? license; - factory Refer.fromJson(Map json) => _$ReferFromJson(json); + Refer({this.sources, this.license}); + + Refer.fromJson(Map json) { + sources = + json["sources"] == null ? null : List.from(json["sources"]); + license = + json["license"] == null ? null : List.from(json["license"]); + } + + Map toJson() { + final Map data = {}; + if (sources != null) { + data["sources"] = sources; + } + if (license != null) { + data["license"] = license; + } + return data; + } } -@freezed -abstract class Now with _$Now { - const factory Now({ - String? obsTime, - String? temp, - String? feelsLike, - String? icon, - String? text, - String? wind360, - String? windDir, - String? windScale, - String? windSpeed, - String? humidity, - String? precip, - String? pressure, - String? vis, - String? cloud, - String? dew, - }) = _Now; +class Now { + String? obsTime; + String? temp; + String? feelsLike; + String? icon; + String? text; + String? wind360; + String? windDir; + String? windScale; + String? windSpeed; + String? humidity; + String? precip; + String? pressure; + String? vis; + String? cloud; + String? dew; - factory Now.fromJson(Map json) => _$NowFromJson(json); + Now({ + this.obsTime, + this.temp, + this.feelsLike, + this.icon, + this.text, + this.wind360, + this.windDir, + this.windScale, + this.windSpeed, + this.humidity, + this.precip, + this.pressure, + this.vis, + this.cloud, + this.dew, + }); + + Now.fromJson(Map json) { + obsTime = json["obsTime"]; + temp = json["temp"]; + feelsLike = json["feelsLike"]; + icon = json["icon"]; + text = json["text"]; + wind360 = json["wind360"]; + windDir = json["windDir"]; + windScale = json["windScale"]; + windSpeed = json["windSpeed"]; + humidity = json["humidity"]; + precip = json["precip"]; + pressure = json["pressure"]; + vis = json["vis"]; + cloud = json["cloud"]; + dew = json["dew"]; + } + + Map toJson() { + final Map data = {}; + data["obsTime"] = obsTime; + data["temp"] = temp; + data["feelsLike"] = feelsLike; + data["icon"] = icon; + data["text"] = text; + data["wind360"] = wind360; + data["windDir"] = windDir; + data["windScale"] = windScale; + data["windSpeed"] = windSpeed; + data["humidity"] = humidity; + data["precip"] = precip; + data["pressure"] = pressure; + data["vis"] = vis; + data["cloud"] = cloud; + data["dew"] = dew; + return data; + } } diff --git a/lib/common/models/weather.freezed.dart b/lib/common/models/weather.freezed.dart deleted file mode 100644 index 7327adb..0000000 --- a/lib/common/models/weather.freezed.dart +++ /dev/null @@ -1,861 +0,0 @@ -// dart format width=80 -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'weather.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$WeatherResponse { - - String? get code; - - String? get updateTime; - - String? get fxLink; - - Now? get now; - - Refer? get refer; - - /// Create a copy of WeatherResponse - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $WeatherResponseCopyWith get copyWith => - _$WeatherResponseCopyWithImpl( - this as WeatherResponse, _$identity); - - /// Serializes this WeatherResponse to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is WeatherResponse && - (identical(other.code, code) || other.code == code) && - (identical(other.updateTime, updateTime) || - other.updateTime == updateTime) && - (identical(other.fxLink, fxLink) || other.fxLink == fxLink) && - (identical(other.now, now) || other.now == now) && - (identical(other.refer, refer) || other.refer == refer)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, code, updateTime, fxLink, now, refer); - - @override - String toString() { - return 'WeatherResponse(code: $code, updateTime: $updateTime, fxLink: $fxLink, now: $now, refer: $refer)'; - } - - -} - -/// @nodoc -abstract mixin class $WeatherResponseCopyWith<$Res> { - factory $WeatherResponseCopyWith(WeatherResponse value, - $Res Function(WeatherResponse) _then) = _$WeatherResponseCopyWithImpl; - - @useResult - $Res call({ - String? code, String? updateTime, String? fxLink, Now? now, Refer? refer - }); - - - $NowCopyWith<$Res>? get now; - - $ReferCopyWith<$Res>? get refer; - -} - -/// @nodoc -class _$WeatherResponseCopyWithImpl<$Res> - implements $WeatherResponseCopyWith<$Res> { - _$WeatherResponseCopyWithImpl(this._self, this._then); - - final WeatherResponse _self; - final $Res Function(WeatherResponse) _then; - - /// Create a copy of WeatherResponse - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? code = freezed, Object? updateTime = freezed, Object? fxLink = freezed, Object? now = freezed, Object? refer = freezed,}) { - return _then(_self.copyWith( - code: freezed == code - ? _self.code - : code // ignore: cast_nullable_to_non_nullable - as String?, - updateTime: freezed == updateTime - ? _self.updateTime - : updateTime // ignore: cast_nullable_to_non_nullable - as String?, - fxLink: freezed == fxLink - ? _self.fxLink - : fxLink // ignore: cast_nullable_to_non_nullable - as String?, - now: freezed == now - ? _self.now - : now // ignore: cast_nullable_to_non_nullable - as Now?, - refer: freezed == refer - ? _self.refer - : refer // ignore: cast_nullable_to_non_nullable - as Refer?, - )); - } - - /// Create a copy of WeatherResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $NowCopyWith<$Res>? get now { - if (_self.now == null) { - return null; - } - - return $NowCopyWith<$Res>(_self.now!, (value) { - return _then(_self.copyWith(now: value)); - }); - } - - /// Create a copy of WeatherResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ReferCopyWith<$Res>? get refer { - if (_self.refer == null) { - return null; - } - - return $ReferCopyWith<$Res>(_self.refer!, (value) { - return _then(_self.copyWith(refer: value)); - }); - } -} - - -/// @nodoc -@JsonSerializable() -class _WeatherResponse implements WeatherResponse { - const _WeatherResponse( - {this.code, this.updateTime, this.fxLink, this.now, this.refer}); - - factory _WeatherResponse.fromJson(Map json) => - _$WeatherResponseFromJson(json); - - @override final String? code; - @override final String? updateTime; - @override final String? fxLink; - @override final Now? now; - @override final Refer? refer; - - /// Create a copy of WeatherResponse - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$WeatherResponseCopyWith<_WeatherResponse> get copyWith => - __$WeatherResponseCopyWithImpl<_WeatherResponse>(this, _$identity); - - @override - Map toJson() { - return _$WeatherResponseToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _WeatherResponse && - (identical(other.code, code) || other.code == code) && - (identical(other.updateTime, updateTime) || - other.updateTime == updateTime) && - (identical(other.fxLink, fxLink) || other.fxLink == fxLink) && - (identical(other.now, now) || other.now == now) && - (identical(other.refer, refer) || other.refer == refer)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash(runtimeType, code, updateTime, fxLink, now, refer); - - @override - String toString() { - return 'WeatherResponse(code: $code, updateTime: $updateTime, fxLink: $fxLink, now: $now, refer: $refer)'; - } - - -} - -/// @nodoc -abstract mixin class _$WeatherResponseCopyWith<$Res> - implements $WeatherResponseCopyWith<$Res> { - factory _$WeatherResponseCopyWith(_WeatherResponse value, - $Res Function(_WeatherResponse) _then) = __$WeatherResponseCopyWithImpl; - - @override - @useResult - $Res call({ - String? code, String? updateTime, String? fxLink, Now? now, Refer? refer - }); - - - @override $NowCopyWith<$Res>? get now; - - @override $ReferCopyWith<$Res>? get refer; - -} - -/// @nodoc -class __$WeatherResponseCopyWithImpl<$Res> - implements _$WeatherResponseCopyWith<$Res> { - __$WeatherResponseCopyWithImpl(this._self, this._then); - - final _WeatherResponse _self; - final $Res Function(_WeatherResponse) _then; - - /// Create a copy of WeatherResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? code = freezed, Object? updateTime = freezed, Object? fxLink = freezed, Object? now = freezed, Object? refer = freezed,}) { - return _then(_WeatherResponse( - code: freezed == code - ? _self.code - : code // ignore: cast_nullable_to_non_nullable - as String?, - updateTime: freezed == updateTime - ? _self.updateTime - : updateTime // ignore: cast_nullable_to_non_nullable - as String?, - fxLink: freezed == fxLink - ? _self.fxLink - : fxLink // ignore: cast_nullable_to_non_nullable - as String?, - now: freezed == now - ? _self.now - : now // ignore: cast_nullable_to_non_nullable - as Now?, - refer: freezed == refer - ? _self.refer - : refer // ignore: cast_nullable_to_non_nullable - as Refer?, - )); - } - - /// Create a copy of WeatherResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $NowCopyWith<$Res>? get now { - if (_self.now == null) { - return null; - } - - return $NowCopyWith<$Res>(_self.now!, (value) { - return _then(_self.copyWith(now: value)); - }); - } - - /// Create a copy of WeatherResponse - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ReferCopyWith<$Res>? get refer { - if (_self.refer == null) { - return null; - } - - return $ReferCopyWith<$Res>(_self.refer!, (value) { - return _then(_self.copyWith(refer: value)); - }); - } -} - - -/// @nodoc -mixin _$Refer { - - List? get sources; - - List? get license; - - /// Create a copy of Refer - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $ReferCopyWith get copyWith => - _$ReferCopyWithImpl(this as Refer, _$identity); - - /// Serializes this Refer to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Refer && - const DeepCollectionEquality().equals(other.sources, sources) && - const DeepCollectionEquality().equals(other.license, license)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, const DeepCollectionEquality().hash(sources), - const DeepCollectionEquality().hash(license)); - - @override - String toString() { - return 'Refer(sources: $sources, license: $license)'; - } - - -} - -/// @nodoc -abstract mixin class $ReferCopyWith<$Res> { - factory $ReferCopyWith(Refer value, - $Res Function(Refer) _then) = _$ReferCopyWithImpl; - - @useResult - $Res call({ - List? sources, List? license - }); - - -} - -/// @nodoc -class _$ReferCopyWithImpl<$Res> - implements $ReferCopyWith<$Res> { - _$ReferCopyWithImpl(this._self, this._then); - - final Refer _self; - final $Res Function(Refer) _then; - - /// Create a copy of Refer - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({Object? sources = freezed, Object? license = freezed,}) { - return _then(_self.copyWith( - sources: freezed == sources - ? _self.sources - : sources // ignore: cast_nullable_to_non_nullable - as List?, - license: freezed == license - ? _self.license - : license // ignore: cast_nullable_to_non_nullable - as List?, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _Refer implements Refer { - const _Refer({final List? sources, final List? license}) - : _sources = sources, - _license = license; - - factory _Refer.fromJson(Map json) => _$ReferFromJson(json); - - final List? _sources; - - @override List? get sources { - final value = _sources; - if (value == null) return null; - if (_sources is EqualUnmodifiableListView) return _sources; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - final List? _license; - - @override List? get license { - final value = _license; - if (value == null) return null; - if (_license is EqualUnmodifiableListView) return _license; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - - /// Create a copy of Refer - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$ReferCopyWith<_Refer> get copyWith => - __$ReferCopyWithImpl<_Refer>(this, _$identity); - - @override - Map toJson() { - return _$ReferToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Refer && - const DeepCollectionEquality().equals(other._sources, _sources) && - const DeepCollectionEquality().equals(other._license, _license)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, const DeepCollectionEquality().hash(_sources), - const DeepCollectionEquality().hash(_license)); - - @override - String toString() { - return 'Refer(sources: $sources, license: $license)'; - } - - -} - -/// @nodoc -abstract mixin class _$ReferCopyWith<$Res> implements $ReferCopyWith<$Res> { - factory _$ReferCopyWith(_Refer value, - $Res Function(_Refer) _then) = __$ReferCopyWithImpl; - - @override - @useResult - $Res call({ - List? sources, List? license - }); - - -} - -/// @nodoc -class __$ReferCopyWithImpl<$Res> - implements _$ReferCopyWith<$Res> { - __$ReferCopyWithImpl(this._self, this._then); - - final _Refer _self; - final $Res Function(_Refer) _then; - - /// Create a copy of Refer - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({Object? sources = freezed, Object? license = freezed,}) { - return _then(_Refer( - sources: freezed == sources - ? _self._sources - : sources // ignore: cast_nullable_to_non_nullable - as List?, - license: freezed == license - ? _self._license - : license // ignore: cast_nullable_to_non_nullable - as List?, - )); - } - - -} - - -/// @nodoc -mixin _$Now { - - String? get obsTime; - - String? get temp; - - String? get feelsLike; - - String? get icon; - - String? get text; - - String? get wind360; - - String? get windDir; - - String? get windScale; - - String? get windSpeed; - - String? get humidity; - - String? get precip; - - String? get pressure; - - String? get vis; - - String? get cloud; - - String? get dew; - - /// Create a copy of Now - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $NowCopyWith get copyWith => - _$NowCopyWithImpl(this as Now, _$identity); - - /// Serializes this Now to a JSON map. - Map toJson(); - - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is Now && - (identical(other.obsTime, obsTime) || other.obsTime == obsTime) && - (identical(other.temp, temp) || other.temp == temp) && - (identical(other.feelsLike, feelsLike) || - other.feelsLike == feelsLike) && - (identical(other.icon, icon) || other.icon == icon) && - (identical(other.text, text) || other.text == text) && - (identical(other.wind360, wind360) || other.wind360 == wind360) && - (identical(other.windDir, windDir) || other.windDir == windDir) && - (identical(other.windScale, windScale) || - other.windScale == windScale) && - (identical(other.windSpeed, windSpeed) || - other.windSpeed == windSpeed) && - (identical(other.humidity, humidity) || - other.humidity == humidity) && - (identical(other.precip, precip) || other.precip == precip) && - (identical(other.pressure, pressure) || - other.pressure == pressure) && - (identical(other.vis, vis) || other.vis == vis) && - (identical(other.cloud, cloud) || other.cloud == cloud) && - (identical(other.dew, dew) || other.dew == dew)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, - obsTime, - temp, - feelsLike, - icon, - text, - wind360, - windDir, - windScale, - windSpeed, - humidity, - precip, - pressure, - vis, - cloud, - dew); - - @override - String toString() { - return 'Now(obsTime: $obsTime, temp: $temp, feelsLike: $feelsLike, icon: $icon, text: $text, wind360: $wind360, windDir: $windDir, windScale: $windScale, windSpeed: $windSpeed, humidity: $humidity, precip: $precip, pressure: $pressure, vis: $vis, cloud: $cloud, dew: $dew)'; - } - - -} - -/// @nodoc -abstract mixin class $NowCopyWith<$Res> { - factory $NowCopyWith(Now value, $Res Function(Now) _then) = _$NowCopyWithImpl; - - @useResult - $Res call({ - String? obsTime, String? temp, String? feelsLike, String? icon, String? text, String? wind360, String? windDir, String? windScale, String? windSpeed, String? humidity, String? precip, String? pressure, String? vis, String? cloud, String? dew - }); - - -} - -/// @nodoc -class _$NowCopyWithImpl<$Res> - implements $NowCopyWith<$Res> { - _$NowCopyWithImpl(this._self, this._then); - - final Now _self; - final $Res Function(Now) _then; - - /// Create a copy of Now - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call( - {Object? obsTime = freezed, Object? temp = freezed, Object? feelsLike = freezed, Object? icon = freezed, Object? text = freezed, Object? wind360 = freezed, Object? windDir = freezed, Object? windScale = freezed, Object? windSpeed = freezed, Object? humidity = freezed, Object? precip = freezed, Object? pressure = freezed, Object? vis = freezed, Object? cloud = freezed, Object? dew = freezed,}) { - return _then(_self.copyWith( - obsTime: freezed == obsTime - ? _self.obsTime - : obsTime // ignore: cast_nullable_to_non_nullable - as String?, - temp: freezed == temp - ? _self.temp - : temp // ignore: cast_nullable_to_non_nullable - as String?, - feelsLike: freezed == feelsLike - ? _self.feelsLike - : feelsLike // ignore: cast_nullable_to_non_nullable - as String?, - icon: freezed == icon - ? _self.icon - : icon // ignore: cast_nullable_to_non_nullable - as String?, - text: freezed == text - ? _self.text - : text // ignore: cast_nullable_to_non_nullable - as String?, - wind360: freezed == wind360 - ? _self.wind360 - : wind360 // ignore: cast_nullable_to_non_nullable - as String?, - windDir: freezed == windDir - ? _self.windDir - : windDir // ignore: cast_nullable_to_non_nullable - as String?, - windScale: freezed == windScale - ? _self.windScale - : windScale // ignore: cast_nullable_to_non_nullable - as String?, - windSpeed: freezed == windSpeed - ? _self.windSpeed - : windSpeed // ignore: cast_nullable_to_non_nullable - as String?, - humidity: freezed == humidity - ? _self.humidity - : humidity // ignore: cast_nullable_to_non_nullable - as String?, - precip: freezed == precip - ? _self.precip - : precip // ignore: cast_nullable_to_non_nullable - as String?, - pressure: freezed == pressure - ? _self.pressure - : pressure // ignore: cast_nullable_to_non_nullable - as String?, - vis: freezed == vis - ? _self.vis - : vis // ignore: cast_nullable_to_non_nullable - as String?, - cloud: freezed == cloud - ? _self.cloud - : cloud // ignore: cast_nullable_to_non_nullable - as String?, - dew: freezed == dew - ? _self.dew - : dew // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - -} - - -/// @nodoc -@JsonSerializable() -class _Now implements Now { - const _Now( - {this.obsTime, this.temp, this.feelsLike, this.icon, this.text, this.wind360, this.windDir, this.windScale, this.windSpeed, this.humidity, this.precip, this.pressure, this.vis, this.cloud, this.dew}); - - factory _Now.fromJson(Map json) => _$NowFromJson(json); - - @override final String? obsTime; - @override final String? temp; - @override final String? feelsLike; - @override final String? icon; - @override final String? text; - @override final String? wind360; - @override final String? windDir; - @override final String? windScale; - @override final String? windSpeed; - @override final String? humidity; - @override final String? precip; - @override final String? pressure; - @override final String? vis; - @override final String? cloud; - @override final String? dew; - - /// Create a copy of Now - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$NowCopyWith<_Now> get copyWith => - __$NowCopyWithImpl<_Now>(this, _$identity); - - @override - Map toJson() { - return _$NowToJson(this,); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _Now && - (identical(other.obsTime, obsTime) || other.obsTime == obsTime) && - (identical(other.temp, temp) || other.temp == temp) && - (identical(other.feelsLike, feelsLike) || - other.feelsLike == feelsLike) && - (identical(other.icon, icon) || other.icon == icon) && - (identical(other.text, text) || other.text == text) && - (identical(other.wind360, wind360) || other.wind360 == wind360) && - (identical(other.windDir, windDir) || other.windDir == windDir) && - (identical(other.windScale, windScale) || - other.windScale == windScale) && - (identical(other.windSpeed, windSpeed) || - other.windSpeed == windSpeed) && - (identical(other.humidity, humidity) || - other.humidity == humidity) && - (identical(other.precip, precip) || other.precip == precip) && - (identical(other.pressure, pressure) || - other.pressure == pressure) && - (identical(other.vis, vis) || other.vis == vis) && - (identical(other.cloud, cloud) || other.cloud == cloud) && - (identical(other.dew, dew) || other.dew == dew)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => - Object.hash( - runtimeType, - obsTime, - temp, - feelsLike, - icon, - text, - wind360, - windDir, - windScale, - windSpeed, - humidity, - precip, - pressure, - vis, - cloud, - dew); - - @override - String toString() { - return 'Now(obsTime: $obsTime, temp: $temp, feelsLike: $feelsLike, icon: $icon, text: $text, wind360: $wind360, windDir: $windDir, windScale: $windScale, windSpeed: $windSpeed, humidity: $humidity, precip: $precip, pressure: $pressure, vis: $vis, cloud: $cloud, dew: $dew)'; - } - - -} - -/// @nodoc -abstract mixin class _$NowCopyWith<$Res> implements $NowCopyWith<$Res> { - factory _$NowCopyWith(_Now value, - $Res Function(_Now) _then) = __$NowCopyWithImpl; - - @override - @useResult - $Res call({ - String? obsTime, String? temp, String? feelsLike, String? icon, String? text, String? wind360, String? windDir, String? windScale, String? windSpeed, String? humidity, String? precip, String? pressure, String? vis, String? cloud, String? dew - }); - - -} - -/// @nodoc -class __$NowCopyWithImpl<$Res> - implements _$NowCopyWith<$Res> { - __$NowCopyWithImpl(this._self, this._then); - - final _Now _self; - final $Res Function(_Now) _then; - - /// Create a copy of Now - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call( - {Object? obsTime = freezed, Object? temp = freezed, Object? feelsLike = freezed, Object? icon = freezed, Object? text = freezed, Object? wind360 = freezed, Object? windDir = freezed, Object? windScale = freezed, Object? windSpeed = freezed, Object? humidity = freezed, Object? precip = freezed, Object? pressure = freezed, Object? vis = freezed, Object? cloud = freezed, Object? dew = freezed,}) { - return _then(_Now( - obsTime: freezed == obsTime - ? _self.obsTime - : obsTime // ignore: cast_nullable_to_non_nullable - as String?, - temp: freezed == temp - ? _self.temp - : temp // ignore: cast_nullable_to_non_nullable - as String?, - feelsLike: freezed == feelsLike - ? _self.feelsLike - : feelsLike // ignore: cast_nullable_to_non_nullable - as String?, - icon: freezed == icon - ? _self.icon - : icon // ignore: cast_nullable_to_non_nullable - as String?, - text: freezed == text - ? _self.text - : text // ignore: cast_nullable_to_non_nullable - as String?, - wind360: freezed == wind360 - ? _self.wind360 - : wind360 // ignore: cast_nullable_to_non_nullable - as String?, - windDir: freezed == windDir - ? _self.windDir - : windDir // ignore: cast_nullable_to_non_nullable - as String?, - windScale: freezed == windScale - ? _self.windScale - : windScale // ignore: cast_nullable_to_non_nullable - as String?, - windSpeed: freezed == windSpeed - ? _self.windSpeed - : windSpeed // ignore: cast_nullable_to_non_nullable - as String?, - humidity: freezed == humidity - ? _self.humidity - : humidity // ignore: cast_nullable_to_non_nullable - as String?, - precip: freezed == precip - ? _self.precip - : precip // ignore: cast_nullable_to_non_nullable - as String?, - pressure: freezed == pressure - ? _self.pressure - : pressure // ignore: cast_nullable_to_non_nullable - as String?, - vis: freezed == vis - ? _self.vis - : vis // ignore: cast_nullable_to_non_nullable - as String?, - cloud: freezed == cloud - ? _self.cloud - : cloud // ignore: cast_nullable_to_non_nullable - as String?, - dew: freezed == dew - ? _self.dew - : dew // ignore: cast_nullable_to_non_nullable - as String?, - )); - } - - -} - -// dart format on diff --git a/lib/common/models/weather.g.dart b/lib/common/models/weather.g.dart deleted file mode 100644 index 84f8dc4..0000000 --- a/lib/common/models/weather.g.dart +++ /dev/null @@ -1,79 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'weather.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_WeatherResponse _$WeatherResponseFromJson(Map json) => - _WeatherResponse( - code: json['code'] as String?, - updateTime: json['updateTime'] as String?, - fxLink: json['fxLink'] as String?, - now: - json['now'] == null - ? null - : Now.fromJson(json['now'] as Map), - refer: - json['refer'] == null - ? null - : Refer.fromJson(json['refer'] as Map), - ); - -Map _$WeatherResponseToJson(_WeatherResponse instance) => - { - if (instance.code case final value?) 'code': value, - if (instance.updateTime case final value?) 'updateTime': value, - if (instance.fxLink case final value?) 'fxLink': value, - if (instance.now case final value?) 'now': value, - if (instance.refer case final value?) 'refer': value, - }; - -_Refer _$ReferFromJson(Map json) => _Refer( - sources: - (json['sources'] as List?)?.map((e) => e as String).toList(), - license: - (json['license'] as List?)?.map((e) => e as String).toList(), -); - -Map _$ReferToJson(_Refer instance) => { - if (instance.sources case final value?) 'sources': value, - if (instance.license case final value?) 'license': value, -}; - -_Now _$NowFromJson(Map json) => _Now( - obsTime: json['obsTime'] as String?, - temp: json['temp'] as String?, - feelsLike: json['feelsLike'] as String?, - icon: json['icon'] as String?, - text: json['text'] as String?, - wind360: json['wind360'] as String?, - windDir: json['windDir'] as String?, - windScale: json['windScale'] as String?, - windSpeed: json['windSpeed'] as String?, - humidity: json['humidity'] as String?, - precip: json['precip'] as String?, - pressure: json['pressure'] as String?, - vis: json['vis'] as String?, - cloud: json['cloud'] as String?, - dew: json['dew'] as String?, -); - -Map _$NowToJson(_Now instance) => { - if (instance.obsTime case final value?) 'obsTime': value, - if (instance.temp case final value?) 'temp': value, - if (instance.feelsLike case final value?) 'feelsLike': value, - if (instance.icon case final value?) 'icon': value, - if (instance.text case final value?) 'text': value, - if (instance.wind360 case final value?) 'wind360': value, - if (instance.windDir case final value?) 'windDir': value, - if (instance.windScale case final value?) 'windScale': value, - if (instance.windSpeed case final value?) 'windSpeed': value, - if (instance.humidity case final value?) 'humidity': value, - if (instance.precip case final value?) 'precip': value, - if (instance.pressure case final value?) 'pressure': value, - if (instance.vis case final value?) 'vis': value, - if (instance.cloud case final value?) 'cloud': value, - if (instance.dew case final value?) 'dew': value, -}; diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 5fea45e..9e70cdc 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -62,7 +62,8 @@ import 'app_localizations_zh.dart'; /// be consistent with the languages listed in the AppLocalizations.supportedLocales /// property. abstract class AppLocalizations { - AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + AppLocalizations(String locale) + : localeName = intl.Intl.canonicalizedLocale(locale.toString()); final String localeName; @@ -70,7 +71,8 @@ abstract class AppLocalizations { return Localizations.of(context, AppLocalizations); } - static const LocalizationsDelegate delegate = _AppLocalizationsDelegate(); + static const LocalizationsDelegate delegate = + _AppLocalizationsDelegate(); /// A list of this localizations delegate along with the default localizations /// delegates. @@ -82,17 +84,18 @@ abstract class AppLocalizations { /// Additional delegates can be added by appending to this list in /// MaterialApp. This list does not have to be used at all if a custom list /// of delegates is preferred or required. - static const List> localizationsDelegates = >[ - delegate, - GlobalMaterialLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - ]; + static const List> localizationsDelegates = + >[ + delegate, + GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ]; /// A list of this localizations delegate's supported locales. static const List supportedLocales = [ Locale('en'), - Locale('zh') + Locale('zh'), ]; /// No description provided for @ok. @@ -1830,7 +1833,8 @@ abstract class AppLocalizations { String get labTencentCloud; } -class _AppLocalizationsDelegate extends LocalizationsDelegate { +class _AppLocalizationsDelegate + extends LocalizationsDelegate { const _AppLocalizationsDelegate(); @override @@ -1839,25 +1843,26 @@ class _AppLocalizationsDelegate extends LocalizationsDelegate } @override - bool isSupported(Locale locale) => ['en', 'zh'].contains(locale.languageCode); + bool isSupported(Locale locale) => + ['en', 'zh'].contains(locale.languageCode); @override bool shouldReload(_AppLocalizationsDelegate old) => false; } AppLocalizations lookupAppLocalizations(Locale locale) { - - // Lookup logic when only language code is specified. switch (locale.languageCode) { - case 'en': return AppLocalizationsEn(); - case 'zh': return AppLocalizationsZh(); + case 'en': + return AppLocalizationsEn(); + case 'zh': + return AppLocalizationsZh(); } throw FlutterError( 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' 'an issue with the localizations generation tool. Please file an issue ' 'on GitHub with a reproducible sample app and the gen-l10n configuration ' - 'that was used.' + 'that was used.', ); } diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 428d08c..93a7f8a 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -1,5 +1,6 @@ // ignore: unused_import import 'package:intl/intl.dart' as intl; + import 'app_localizations.dart'; // ignore_for_file: type=lint @@ -45,7 +46,8 @@ class AppLocalizationsEn extends AppLocalizations { String get startTitle3 => 'An ad-free, social-free, intimate diary'; @override - String get welcome1 => 'Thanks for downloading this product! Before use, we hope you can read and understand our '; + String get welcome1 => + 'Thanks for downloading this product! Before use, we hope you can read and understand our '; @override String get welcome2 => 'Privacy Policy '; @@ -57,7 +59,8 @@ class AppLocalizationsEn extends AppLocalizations { String get welcome4 => 'User Agreement'; @override - String get welcome5 => '. We always respect and will strictly protect your legitimate rights and interests when using this product from any infringement. If you begin to use this product, you will be deemed to have accepted this Agreement. If you do not accept all the terms of this Agreement, do not begin to use this Product.'; + String get welcome5 => + '. We always respect and will strictly protect your legitimate rights and interests when using this product from any infringement. If you begin to use this product, you will be deemed to have accepted this Agreement. If you do not accept all the terms of this Agreement, do not begin to use this Product.'; @override String get startChoice1 => 'Exit'; @@ -69,7 +72,8 @@ class AppLocalizationsEn extends AppLocalizations { String get permission1 => 'Permission grant'; @override - String get permission2 => 'In order to better use the experience, we need the following permissions'; + String get permission2 => + 'In order to better use the experience, we need the following permissions'; @override String get permission3 => '• Location permission (for getting the weather)'; @@ -114,7 +118,8 @@ class AppLocalizationsEn extends AppLocalizations { String get settingExportDialogTitle => 'Data Export'; @override - String get settingExportDialogContent => 'After confirmation, the current application\'s data will be exported as a ZIP file, which can be used for intra application import.'; + String get settingExportDialogContent => + 'After confirmation, the current application\'s data will be exported as a ZIP file, which can be used for intra application import.'; @override String get settingImport => 'Import'; @@ -123,7 +128,8 @@ class AppLocalizationsEn extends AppLocalizations { String get settingImportDialogTitle => 'Data Import'; @override - String get settingImportDialogContent => 'Importing data will overwrite the existing data and the original data cannot be restored! Please confirm that the original data has been backed up.'; + String get settingImportDialogContent => + 'Importing data will overwrite the existing data and the original data cannot be restored! Please confirm that the original data has been backed up.'; @override String get settingImportSelectFile => 'Select File'; @@ -189,7 +195,8 @@ class AppLocalizationsEn extends AppLocalizations { String get settingLockSupportBiometricsDes => 'System supports biometrics'; @override - String get settingLockNotSupportBiometricsDes => 'System does not support biometrics'; + String get settingLockNotSupportBiometricsDes => + 'System does not support biometrics'; @override String get settingLockOpen => 'Open'; @@ -207,13 +214,15 @@ class AppLocalizationsEn extends AppLocalizations { String get settingLockChooseLockType => 'Please select a password type'; @override - String get settingLockResetLock => 'Password has been enabled, reset please close first'; + String get settingLockResetLock => + 'Password has been enabled, reset please close first'; @override String get settingBackendPrivacyProtection => 'Background Privacy Protection'; @override - String get settingBackendPrivacyProtectionDes => 'When the application is in the background, hide the application content'; + String get settingBackendPrivacyProtectionDes => + 'When the application is in the background, hide the application content'; @override String get settingUserKey => 'Private Key'; @@ -225,13 +234,15 @@ class AppLocalizationsEn extends AppLocalizations { String get settingUserKeySet => 'Setting key'; @override - String get settingUserKeySetDes => '⚠️ The key cannot be obtained after setting it, please keep it properly. If you need to use encrypted data on other devices, please make sure to use the same key.'; + String get settingUserKeySetDes => + '⚠️ The key cannot be obtained after setting it, please keep it properly. If you need to use encrypted data on other devices, please make sure to use the same key.'; @override String get settingUserKeyReset => 'Reset key'; @override - String get settingUserKeyResetDes => 'Are you sure you want to reset the key?'; + String get settingUserKeyResetDes => + 'Are you sure you want to reset the key?'; @override String get settingUserKeyHasSet => 'Set'; @@ -504,16 +515,19 @@ class AppLocalizationsEn extends AppLocalizations { String get lanTransferChangeTransferPort => 'Change transfer port'; @override - String get lanTransferChangePortDes => 'Please ensure that the ports of the two devices are consistent. You need to rescan after changing'; + String get lanTransferChangePortDes => + 'Please ensure that the ports of the two devices are consistent. You need to rescan after changing'; @override - String get lanTransferChangePortError1 => 'Please enter the temporary port number (49152-65535)'; + String get lanTransferChangePortError1 => + 'Please enter the temporary port number (49152-65535)'; @override String get lanTransferChangePortError2 => 'Please enter the port number'; @override - String get lanTransferReceiveDes => 'Do not close the application during the receiving process'; + String get lanTransferReceiveDes => + 'Do not close the application during the receiving process'; @override String get lanTransferReceiveServerStart => 'The server has started'; @@ -525,19 +539,22 @@ class AppLocalizationsEn extends AppLocalizations { String get webdavSyncWhenStartUp => 'Sync on startup'; @override - String get webdavSyncWhenStartUpDes => 'Automatically synchronize when starting the application'; + String get webdavSyncWhenStartUpDes => + 'Automatically synchronize when starting the application'; @override String get webdavSyncAfterChange => 'Sync after change'; @override - String get webdavSyncAfterChangeDes => 'Automatically synchronize after changing data'; + String get webdavSyncAfterChangeDes => + 'Automatically synchronize after changing data'; @override String get webdavSyncEncryption => 'Encryption'; @override - String get webdavSyncEncryptionDes => 'Encrypting synchronous data, you need to set a private key'; + String get webdavSyncEncryptionDes => + 'Encrypting synchronous data, you need to set a private key'; @override String get webdavOptionServer => 'Server address'; @@ -570,7 +587,8 @@ class AppLocalizationsEn extends AppLocalizations { String get diarySettingRichText => 'Rich text'; @override - String get diarySettingRichTextDes => 'Supports more styles and attachments to make content presentation richer'; + String get diarySettingRichTextDes => + 'Supports more styles and attachments to make content presentation richer'; @override String get diarySettingShowHeaderImage => 'Diary page display header image'; @@ -579,7 +597,8 @@ class AppLocalizationsEn extends AppLocalizations { String get diarySettingPlainText => 'Plain text'; @override - String get diarySettingPlainTextDes => 'Remove redundant styles and enjoy a purer writing experience'; + String get diarySettingPlainTextDes => + 'Remove redundant styles and enjoy a purer writing experience'; @override String get diarySettingFirstLineIndent => 'Automatic first line indent'; @@ -638,7 +657,8 @@ class AppLocalizationsEn extends AppLocalizations { String get noticeEnableLocation => 'Please enable location permission'; @override - String get noticeEnableLocation2 => 'Please go to settings to enable location permissions'; + String get noticeEnableLocation2 => + 'Please go to settings to enable location permissions'; @override String get diarySearch => 'Search'; @@ -890,7 +910,8 @@ class AppLocalizationsEn extends AppLocalizations { String get inputMethodHandelInput => 'Manual input'; @override - String get getKeyFromConsole => 'Please get the key from the corresponding console'; + String get getKeyFromConsole => + 'Please get the key from the corresponding console'; @override String get hasOption => 'Configured'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index db44080..ffdb6a9 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -1,5 +1,6 @@ // ignore: unused_import import 'package:intl/intl.dart' as intl; + import 'app_localizations.dart'; // ignore_for_file: type=lint @@ -57,7 +58,8 @@ class AppLocalizationsZh extends AppLocalizations { String get welcome4 => '《用户协议》'; @override - String get welcome5 => '。我们一向尊重并会严格保护您在使用本产品时的合法权益不受到任何侵犯。用户开始使用本产品将视为已经接受本协议,如果您不能接受本协议中的全部条款,请勿开始使用本产品。'; + String get welcome5 => + '。我们一向尊重并会严格保护您在使用本产品时的合法权益不受到任何侵犯。用户开始使用本产品将视为已经接受本协议,如果您不能接受本协议中的全部条款,请勿开始使用本产品。'; @override String get startChoice1 => '退出'; @@ -114,7 +116,8 @@ class AppLocalizationsZh extends AppLocalizations { String get settingExportDialogTitle => '数据导出'; @override - String get settingExportDialogContent => '确认后会将当前应用的数据导出为 ZIP 文件,文件可用于应用内导入使用。'; + String get settingExportDialogContent => + '确认后会将当前应用的数据导出为 ZIP 文件,文件可用于应用内导入使用。'; @override String get settingImport => '导入'; @@ -123,7 +126,8 @@ class AppLocalizationsZh extends AppLocalizations { String get settingImportDialogTitle => '数据导入'; @override - String get settingImportDialogContent => '导入数据会覆盖当前已经有的数据,且原有数据无法恢复!请确认备份好原有数据。'; + String get settingImportDialogContent => + '导入数据会覆盖当前已经有的数据,且原有数据无法恢复!请确认备份好原有数据。'; @override String get settingImportSelectFile => '选择文件'; @@ -225,7 +229,8 @@ class AppLocalizationsZh extends AppLocalizations { String get settingUserKeySet => '设置密钥'; @override - String get settingUserKeySetDes => '⚠️ 密钥设置后无法获取,请妥善保管,如果您需要在其他设备上使用加密数据,请确保使用相同的密钥。'; + String get settingUserKeySetDes => + '⚠️ 密钥设置后无法获取,请妥善保管,如果您需要在其他设备上使用加密数据,请确保使用相同的密钥。'; @override String get settingUserKeyReset => '重置密钥'; diff --git a/lib/pages/analyse/analyse_logic.dart b/lib/pages/analyse/analyse_logic.dart index 813d0a9..5a19174 100644 --- a/lib/pages/analyse/analyse_logic.dart +++ b/lib/pages/analyse/analyse_logic.dart @@ -81,12 +81,11 @@ class AnalyseLogic extends GetxController { state.reply = ''; update(); final stream = await Api.getHunYuan(check['id']!, check['key']!, [ - const Message( - role: 'system', - content: - '我会给你一组来自一款日记APP的数据,其中包含了在某一段时间内,日记所记录的心情情况,根据这些数据,分析用户最近的心情状况,并给出合理的建议,心情的值是一个从0.0到1.0的浮点数,从小到大表示心情从坏到好,给你的值是一个Map,其中的Key是心情指数,Value是对应心情指数出现的次数。给出的输出应当是结论,不需要给出分析过程,不需要其他反馈。', + Message( + 'system', + '我会给你一组来自一款日记APP的数据,其中包含了在某一段时间内,日记所记录的心情情况,根据这些数据,分析用户最近的心情状况,并给出合理的建议,心情的值是一个从0.0到1.0的浮点数,从小到大表示心情从坏到好,给你的值是一个Map,其中的Key是心情指数,Value是对应心情指数出现的次数。给出的输出应当是结论,不需要给出分析过程,不需要其他反馈。', ), - Message(role: 'user', content: '心情:${state.moodMap.toString()}'), + Message('user', '心情:${state.moodMap.toString()}'), ], 0); stream?.listen((content) { if (content != '' && content.contains('data')) { diff --git a/lib/pages/assistant/assistant_logic.dart b/lib/pages/assistant/assistant_logic.dart index 9121192..d314388 100644 --- a/lib/pages/assistant/assistant_logic.dart +++ b/lib/pages/assistant/assistant_logic.dart @@ -91,7 +91,7 @@ class AssistantLogic extends GetxController { unFocus(); //拿到用户提问后,对话上下文中增加一项用户提问 final askTime = DateTime.now(); - state.messages[askTime] = Message(role: 'user', content: ask); + state.messages[askTime] = Message('user', ask); update(); toBottom(); //带着上下文请求 @@ -103,7 +103,7 @@ class AssistantLogic extends GetxController { ); //如果收到了请求,添加一个回答上下文 final replyTime = DateTime.now(); - state.messages[replyTime] = const Message(role: 'assistant', content: ''); + state.messages[replyTime] = Message('assistant', ''); update(); //接收stream stream?.listen((content) { @@ -111,11 +111,8 @@ class AssistantLogic extends GetxController { final HunyuanResponse result = HunyuanResponse.fromJson( jsonDecode(content.split('data: ')[1]), ); - final currentMessage = state.messages[replyTime]!; - state.messages[replyTime] = currentMessage.copyWith( - content: - currentMessage.content + result.choices!.first.delta!.content!, - ); + state.messages[replyTime]!.content += + result.choices!.first.delta!.content!; HapticFeedback.vibrate(); update(); toBottom(); diff --git a/lib/pages/edit/edit_logic.dart b/lib/pages/edit/edit_logic.dart index 6ae7f3e..2edda62 100644 --- a/lib/pages/edit/edit_logic.dart +++ b/lib/pages/edit/edit_logic.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; -import 'package:dartx/dartx.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -541,51 +540,44 @@ class EditLogic extends GetxController { //获取天气,同时获取定位 Future getPositionAndWeather({required BuildContext context}) async { final key = PrefUtil.getValue('qweatherKey'); - final apiHost = PrefUtil.getValue('qweatherApiHost'); - if (key.isNullOrBlank || apiHost.isNullOrBlank) return; + if (key == null) return; - try { - state.isProcessing = true; - update(['Weather']); + state.isProcessing = true; + update(['Weather']); - // 获取定位 - final position = await Api.updatePosition(context); - if (position == null && context.mounted) { - _handleError(context, context.l10n.locationError); - return; - } - state.currentDiary.position = position!; - if (!context.mounted) return; - // 获取天气 - final weather = await Api.updateWeather( - context: context, - position: LatLng(double.parse(position[0]), double.parse(position[1])), - ); - if (weather == null && context.mounted) { - _handleError(context, context.l10n.weatherError); - return; - } - state.currentDiary.weather = weather!; - state.isProcessing = false; - if (context.mounted) { - toast.success(message: context.l10n.weatherSuccess); - } - update(['Weather']); - } catch (e) { - state.isProcessing = false; - update(['Weather']); - if (context.mounted) { - toast.error(message: context.l10n.weatherError); - } + // 获取定位 + final position = await Api.updatePosition(context); + if (position == null && context.mounted) { + _handleError(context.l10n.locationError); + return; } + + state.currentDiary.position = position!; + + if (!context.mounted) return; + // 获取天气 + final weather = await Api.updateWeather( + context: context, + position: LatLng(double.parse(position[0]), double.parse(position[1])), + ); + + if (weather == null && context.mounted) { + _handleError(context.l10n.weatherError); + return; + } + + state.currentDiary.weather = weather!; + state.isProcessing = false; + if (context.mounted) { + toast.success(message: context.l10n.weatherSuccess); + } + update(['Weather']); } - void _handleError(BuildContext context, String message) { + void _handleError(String message) { state.isProcessing = false; + toast.error(message: message); update(['Weather']); - if (context.mounted) { - toast.error(message: message); - } } Future pickAudio(BuildContext context) async { diff --git a/lib/pages/laboratory/laboratory_logic.dart b/lib/pages/laboratory/laboratory_logic.dart index d76fd3b..91a04ac 100644 --- a/lib/pages/laboratory/laboratory_logic.dart +++ b/lib/pages/laboratory/laboratory_logic.dart @@ -44,17 +44,6 @@ class LaboratoryLogic extends GetxController { } } - Future setQweatherApiHost({required String host}) async { - try { - await PrefUtil.setValue('qweatherApiHost', host); - return true; - } catch (e) { - return false; - } finally { - update(); - } - } - Future setTiandituKey({required String key}) async { try { await PrefUtil.setValue('tiandituKey', key); diff --git a/lib/pages/laboratory/laboratory_view.dart b/lib/pages/laboratory/laboratory_view.dart index b80ae12..d262245 100644 --- a/lib/pages/laboratory/laboratory_view.dart +++ b/lib/pages/laboratory/laboratory_view.dart @@ -63,21 +63,6 @@ class LaboratoryPage extends StatelessWidget { } }, ), - const Gap(12), - QrInputTile( - title: '${context.l10n.labQweather} API Host', - value: PrefUtil.getValue('qweatherApiHost') ?? '', - prefix: 'qweatherApiHost', - onValue: (value) async { - final res = await logic.setQweatherApiHost(host: value); - if (res) { - toast.success(); - } else { - toast.error(); - } - }, - ), - const Gap(12), QrInputTile( title: '${context.l10n.labTianditu} Key', diff --git a/lib/persistence/pref.dart b/lib/persistence/pref.dart index 422b591..3331196 100644 --- a/lib/persistence/pref.dart +++ b/lib/persistence/pref.dart @@ -42,8 +42,6 @@ class PrefUtil { 'fontTheme', //和风key 'qweatherKey', - // 和风apihost, - 'qweatherApiHost', 'tencentId', 'tencentKey', 'tiandituKey', diff --git a/lib/utils/http_util.dart b/lib/utils/http_util.dart index 2238781..0f0088f 100644 --- a/lib/utils/http_util.dart +++ b/lib/utils/http_util.dart @@ -19,10 +19,7 @@ class HttpUtil { InterceptorsWrapper( onError: (error, handler) { if (error.type != DioExceptionType.cancel) { - toast.error( - message: - 'Network Error ${error.response?.statusCode} ${error.response?.statusMessage} ${error.message}', - ); + toast.error(message: 'Network Error ${error.error}'); } handler.next(error); }, diff --git a/lib/utils/notice_util.dart b/lib/utils/notice_util.dart index ada08a5..665d2fd 100644 --- a/lib/utils/notice_util.dart +++ b/lib/utils/notice_util.dart @@ -141,7 +141,7 @@ class NoticeUtil { return DecoratedBox( decoration: BoxDecoration( - color: context.theme.colorScheme.surfaceContainerHighest.withValues( + color: context.theme.colorScheme.surfaceContainerHigh.withValues( alpha: 0.9, ), borderRadius: AppBorderRadius.mediumBorderRadius,