fix: qweather api error

(cherry picked from commit 2e206a9335)
This commit is contained in:
ZhuJHua
2025-04-18 11:54:16 +08:00
parent 8d9f380ec5
commit 64ca18ef44
31 changed files with 7040 additions and 974 deletions

19
build.yaml Normal file
View File

@@ -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

View File

@@ -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<String>('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<String>('qweatherApiHost')}/v7/weather/now',
parameters: parameters,
);
final weather = await compute(

View File

@@ -1,113 +1,45 @@
class GeoResponse {
String? code;
List<Location>? 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<String, dynamic> 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>? location,
Refer? refer,
}) = _GeoResponse;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data["code"] = code;
data["location"] = location?.map((e) => e.toJson()).toList();
data["refer"] = refer?.toJson();
return data;
}
factory GeoResponse.fromJson(Map<String, dynamic> json) =>
_$GeoResponseFromJson(json);
}
class Refer {
List<String>? sources;
List<String>? license;
@freezed
abstract class Refer with _$Refer {
const factory Refer({List<String>? sources, List<String>? license}) = _Refer;
Refer({this.sources, this.license});
Refer.fromJson(Map<String, dynamic> json) {
sources =
json["sources"] == null ? null : List<String>.from(json["sources"]);
license =
json["license"] == null ? null : List<String>.from(json["license"]);
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data["sources"] = sources;
data["license"] = license;
return data;
}
factory Refer.fromJson(Map<String, dynamic> 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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
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<String, dynamic> json) =>
_$LocationFromJson(json);
}

View File

@@ -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>(T value) => value;
/// @nodoc
mixin _$GeoResponse {
String? get code;
List<Location>? 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<GeoResponse> get copyWith =>
_$GeoResponseCopyWithImpl<GeoResponse>(this as GeoResponse, _$identity);
/// Serializes this GeoResponse to a JSON map.
Map<String, dynamic> 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>? 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<Location>?,
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>? location, this.refer})
: _location = location;
factory _GeoResponse.fromJson(Map<String, dynamic> json) =>
_$GeoResponseFromJson(json);
@override final String? code;
final List<Location>? _location;
@override List<Location>? 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<String, dynamic> 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>? 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<Location>?,
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<String>? get sources;
List<String>? 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<Refer> get copyWith =>
_$ReferCopyWithImpl<Refer>(this as Refer, _$identity);
/// Serializes this Refer to a JSON map.
Map<String, dynamic> 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<String>? sources, List<String>? 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<String>?,
license: freezed == license
? _self.license
: license // ignore: cast_nullable_to_non_nullable
as List<String>?,
));
}
}
/// @nodoc
@JsonSerializable()
class _Refer implements Refer {
const _Refer({final List<String>? sources, final List<String>? license})
: _sources = sources,
_license = license;
factory _Refer.fromJson(Map<String, dynamic> json) => _$ReferFromJson(json);
final List<String>? _sources;
@override List<String>? 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<String>? _license;
@override List<String>? 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<String, dynamic> 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<String>? sources, List<String>? 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<String>?,
license: freezed == license
? _self._license
: license // ignore: cast_nullable_to_non_nullable
as List<String>?,
));
}
}
/// @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<Location> get copyWith =>
_$LocationCopyWithImpl<Location>(this as Location, _$identity);
/// Serializes this Location to a JSON map.
Map<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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

View File

@@ -0,0 +1,70 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'geo.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_GeoResponse _$GeoResponseFromJson(Map<String, dynamic> json) => _GeoResponse(
code: json['code'] as String?,
location:
(json['location'] as List<dynamic>?)
?.map((e) => Location.fromJson(e as Map<String, dynamic>))
.toList(),
refer:
json['refer'] == null
? null
: Refer.fromJson(json['refer'] as Map<String, dynamic>),
);
Map<String, dynamic> _$GeoResponseToJson(_GeoResponse instance) =>
<String, dynamic>{
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<String, dynamic> json) => _Refer(
sources:
(json['sources'] as List<dynamic>?)?.map((e) => e as String).toList(),
license:
(json['license'] as List<dynamic>?)?.map((e) => e as String).toList(),
);
Map<String, dynamic> _$ReferToJson(_Refer instance) => <String, dynamic>{
if (instance.sources case final value?) 'sources': value,
if (instance.license case final value?) 'license': value,
};
_Location _$LocationFromJson(Map<String, dynamic> 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<String, dynamic> _$LocationToJson(_Location instance) => <String, dynamic>{
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,
};

View File

@@ -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>? 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<String, dynamic> 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>? assets,
@JsonKey(name: 'tarball_url') String? tarballUrl,
@JsonKey(name: 'zipball_url') String? zipballUrl,
String? body,
}) = _GithubRelease;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
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<String, dynamic> 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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
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<String, dynamic> 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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
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<String, dynamic> 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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
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<String, dynamic> json) => _$AuthorFromJson(json);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,183 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'github.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_GithubRelease _$GithubReleaseFromJson(Map<String, dynamic> 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<String, dynamic>),
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<dynamic>?)
?.map((e) => Assets.fromJson(e as Map<String, dynamic>))
.toList(),
tarballUrl: json['tarball_url'] as String?,
zipballUrl: json['zipball_url'] as String?,
body: json['body'] as String?,
);
Map<String, dynamic> _$GithubReleaseToJson(_GithubRelease instance) =>
<String, dynamic>{
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<String, dynamic> 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<String, dynamic>),
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<String, dynamic> _$AssetsToJson(_Assets instance) => <String, dynamic>{
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<String, dynamic> 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<String, dynamic> _$UploaderToJson(_Uploader instance) => <String, dynamic>{
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<String, dynamic> 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<String, dynamic> _$AuthorToJson(_Author instance) => <String, dynamic>{
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,
};

View File

@@ -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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
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<String, dynamic> json) =>
_$HitokotoResponseFromJson(json);
}

View File

@@ -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>(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<HitokotoResponse> get copyWith =>
_$HitokotoResponseCopyWithImpl<HitokotoResponse>(
this as HitokotoResponse, _$identity);
/// Serializes this HitokotoResponse to a JSON map.
Map<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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

View File

@@ -0,0 +1,39 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'hitokoto.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_HitokotoResponse _$HitokotoResponseFromJson(Map<String, dynamic> 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<String, dynamic> _$HitokotoResponseToJson(_HitokotoResponse instance) =>
<String, dynamic>{
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,
};

View File

@@ -1,139 +1,74 @@
class PublicHeader {
String? action;
int? timestamp;
String? version;
String? authorization;
import 'package:freezed_annotation/freezed_annotation.dart';
Map<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> toMap() {
return {'Role': role, 'Content': content};
}
Message.fromMap(Map<String, dynamic> map) {
role = map['Role'];
content = map['Content'];
}
factory Message.fromJson(Map<String, dynamic> json) =>
_$MessageFromJson(json);
}
class HunyuanResponse {
String? note;
List<Choices>? 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>? 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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
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<String, dynamic> 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<String, dynamic> json) {
promptTokens = json["PromptTokens"];
completionTokens = json["CompletionTokens"];
totalTokens = json["TotalTokens"];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data["PromptTokens"] = promptTokens;
data["CompletionTokens"] = completionTokens;
data["TotalTokens"] = totalTokens;
return data;
}
factory Usage.fromJson(Map<String, dynamic> 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<String, dynamic> json) {
finishReason = json["FinishReason"];
delta = json["Delta"] == null ? null : Delta.fromJson(json["Delta"]);
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data["FinishReason"] = finishReason;
if (delta != null) {
data["Delta"] = delta?.toJson();
}
return data;
}
factory Choices.fromJson(Map<String, dynamic> 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<String, dynamic> json) {
role = json["Role"];
content = json["Content"];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data["Role"] = role;
data["Content"] = content;
return data;
}
factory Delta.fromJson(Map<String, dynamic> json) => _$DeltaFromJson(json);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,88 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'hunyuan.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_PublicHeader _$PublicHeaderFromJson(Map<String, dynamic> 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<String, dynamic> _$PublicHeaderToJson(_PublicHeader instance) =>
<String, dynamic>{
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<String, dynamic> json) =>
_Message(role: json['Role'] as String, content: json['Content'] as String);
Map<String, dynamic> _$MessageToJson(_Message instance) => <String, dynamic>{
'Role': instance.role,
'Content': instance.content,
};
_HunyuanResponse _$HunyuanResponseFromJson(Map<String, dynamic> json) =>
_HunyuanResponse(
note: json['Note'] as String?,
choices:
(json['Choices'] as List<dynamic>?)
?.map((e) => Choices.fromJson(e as Map<String, dynamic>))
.toList(),
created: (json['Created'] as num?)?.toInt(),
id: json['Id'] as String?,
usage:
json['Usage'] == null
? null
: Usage.fromJson(json['Usage'] as Map<String, dynamic>),
);
Map<String, dynamic> _$HunyuanResponseToJson(_HunyuanResponse instance) =>
<String, dynamic>{
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<String, dynamic> json) => _Usage(
promptTokens: (json['PromptTokens'] as num?)?.toInt(),
completionTokens: (json['CompletionTokens'] as num?)?.toInt(),
totalTokens: (json['TotalTokens'] as num?)?.toInt(),
);
Map<String, dynamic> _$UsageToJson(_Usage instance) => <String, dynamic>{
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<String, dynamic> json) => _Choices(
finishReason: json['FinishReason'] as String?,
delta:
json['Delta'] == null
? null
: Delta.fromJson(json['Delta'] as Map<String, dynamic>),
);
Map<String, dynamic> _$ChoicesToJson(_Choices instance) => <String, dynamic>{
if (instance.finishReason case final value?) 'FinishReason': value,
if (instance.delta case final value?) 'Delta': value,
};
_Delta _$DeltaFromJson(Map<String, dynamic> json) =>
_Delta(role: json['Role'] as String?, content: json['Content'] as String?);
Map<String, dynamic> _$DeltaToJson(_Delta instance) => <String, dynamic>{
if (instance.role case final value?) 'Role': value,
if (instance.content case final value?) 'Content': value,
};

View File

@@ -1,130 +1,50 @@
class BingImage {
List<Images>? 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<String, dynamic> 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>? images, Tooltips? tooltips}) =
_BingImage;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (images != null) {
data["images"] = images?.map((e) => e.toJson()).toList();
}
if (tooltips != null) {
data["tooltips"] = tooltips?.toJson();
}
return data;
}
factory BingImage.fromJson(Map<String, dynamic> 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<String, dynamic> json) {
loading = json["loading"];
previous = json["previous"];
next = json["next"];
walle = json["walle"];
walls = json["walls"];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data["loading"] = loading;
data["previous"] = previous;
data["next"] = next;
data["walle"] = walle;
data["walls"] = walls;
return data;
}
factory Tooltips.fromJson(Map<String, dynamic> 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<dynamic>? 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<dynamic>? 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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
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<String, dynamic> json) => _$ImagesFromJson(json);
}

View File

@@ -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>(T value) => value;
/// @nodoc
mixin _$BingImage {
List<Images>? 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<BingImage> get copyWith =>
_$BingImageCopyWithImpl<BingImage>(this as BingImage, _$identity);
/// Serializes this BingImage to a JSON map.
Map<String, dynamic> 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>? 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<Images>?,
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>? images, this.tooltips})
: _images = images;
factory _BingImage.fromJson(Map<String, dynamic> json) =>
_$BingImageFromJson(json);
final List<Images>? _images;
@override List<Images>? 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<String, dynamic> 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>? 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<Images>?,
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<Tooltips> get copyWith =>
_$TooltipsCopyWithImpl<Tooltips>(this as Tooltips, _$identity);
/// Serializes this Tooltips to a JSON map.
Map<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<dynamic>? 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<Images> get copyWith =>
_$ImagesCopyWithImpl<Images>(this as Images, _$identity);
/// Serializes this Images to a JSON map.
Map<String, dynamic> 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<dynamic>?,
));
}
}
/// @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<String, dynamic> 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<dynamic>? _hs;
@override List<dynamic>? 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<String, dynamic> 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<dynamic>?,
));
}
}
// dart format on

View File

@@ -0,0 +1,76 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'image.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_BingImage _$BingImageFromJson(Map<String, dynamic> json) => _BingImage(
images:
(json['images'] as List<dynamic>?)
?.map((e) => Images.fromJson(e as Map<String, dynamic>))
.toList(),
tooltips:
json['tooltips'] == null
? null
: Tooltips.fromJson(json['tooltips'] as Map<String, dynamic>),
);
Map<String, dynamic> _$BingImageToJson(_BingImage instance) =>
<String, dynamic>{
if (instance.images case final value?) 'images': value,
if (instance.tooltips case final value?) 'tooltips': value,
};
_Tooltips _$TooltipsFromJson(Map<String, dynamic> 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<String, dynamic> _$TooltipsToJson(_Tooltips instance) => <String, dynamic>{
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<String, dynamic> 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<dynamic>?,
);
Map<String, dynamic> _$ImagesToJson(_Images instance) => <String, dynamic>{
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,
};

View File

@@ -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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
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<String, dynamic> json) =>
_$WeatherResponseFromJson(json);
}
class Refer {
List<String>? sources;
List<String>? license;
@freezed
abstract class Refer with _$Refer {
const factory Refer({List<String>? sources, List<String>? license}) = _Refer;
Refer({this.sources, this.license});
Refer.fromJson(Map<String, dynamic> json) {
sources =
json["sources"] == null ? null : List<String>.from(json["sources"]);
license =
json["license"] == null ? null : List<String>.from(json["license"]);
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (sources != null) {
data["sources"] = sources;
}
if (license != null) {
data["license"] = license;
}
return data;
}
factory Refer.fromJson(Map<String, dynamic> 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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
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<String, dynamic> json) => _$NowFromJson(json);
}

View File

@@ -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>(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<WeatherResponse> get copyWith =>
_$WeatherResponseCopyWithImpl<WeatherResponse>(
this as WeatherResponse, _$identity);
/// Serializes this WeatherResponse to a JSON map.
Map<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String>? get sources;
List<String>? 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<Refer> get copyWith =>
_$ReferCopyWithImpl<Refer>(this as Refer, _$identity);
/// Serializes this Refer to a JSON map.
Map<String, dynamic> 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<String>? sources, List<String>? 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<String>?,
license: freezed == license
? _self.license
: license // ignore: cast_nullable_to_non_nullable
as List<String>?,
));
}
}
/// @nodoc
@JsonSerializable()
class _Refer implements Refer {
const _Refer({final List<String>? sources, final List<String>? license})
: _sources = sources,
_license = license;
factory _Refer.fromJson(Map<String, dynamic> json) => _$ReferFromJson(json);
final List<String>? _sources;
@override List<String>? 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<String>? _license;
@override List<String>? 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<String, dynamic> 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<String>? sources, List<String>? 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<String>?,
license: freezed == license
? _self._license
: license // ignore: cast_nullable_to_non_nullable
as List<String>?,
));
}
}
/// @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<Now> get copyWith =>
_$NowCopyWithImpl<Now>(this as Now, _$identity);
/// Serializes this Now to a JSON map.
Map<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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

View File

@@ -0,0 +1,79 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'weather.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_WeatherResponse _$WeatherResponseFromJson(Map<String, dynamic> 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<String, dynamic>),
refer:
json['refer'] == null
? null
: Refer.fromJson(json['refer'] as Map<String, dynamic>),
);
Map<String, dynamic> _$WeatherResponseToJson(_WeatherResponse instance) =>
<String, dynamic>{
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<String, dynamic> json) => _Refer(
sources:
(json['sources'] as List<dynamic>?)?.map((e) => e as String).toList(),
license:
(json['license'] as List<dynamic>?)?.map((e) => e as String).toList(),
);
Map<String, dynamic> _$ReferToJson(_Refer instance) => <String, dynamic>{
if (instance.sources case final value?) 'sources': value,
if (instance.license case final value?) 'license': value,
};
_Now _$NowFromJson(Map<String, dynamic> 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<String, dynamic> _$NowToJson(_Now instance) => <String, dynamic>{
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,
};

View File

@@ -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<AppLocalizations>(context, AppLocalizations);
}
static const LocalizationsDelegate<AppLocalizations> delegate =
_AppLocalizationsDelegate();
static const LocalizationsDelegate<AppLocalizations> 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<LocalizationsDelegate<dynamic>> localizationsDelegates =
<LocalizationsDelegate<dynamic>>[
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
];
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
];
/// A list of this localizations delegate's supported locales.
static const List<Locale> supportedLocales = <Locale>[
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<AppLocalizations> {
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
const _AppLocalizationsDelegate();
@override
@@ -1843,26 +1839,25 @@ class _AppLocalizationsDelegate
}
@override
bool isSupported(Locale locale) =>
<String>['en', 'zh'].contains(locale.languageCode);
bool isSupported(Locale locale) => <String>['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.'
);
}

View File

@@ -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';

View File

@@ -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 => '重置密钥';

View File

@@ -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')) {

View File

@@ -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();

View File

@@ -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<void> getPositionAndWeather({required BuildContext context}) async {
final key = PrefUtil.getValue<String>('qweatherKey');
if (key == null) return;
final apiHost = PrefUtil.getValue<String>('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<void> pickAudio(BuildContext context) async {

View File

@@ -44,6 +44,17 @@ class LaboratoryLogic extends GetxController {
}
}
Future<bool> setQweatherApiHost({required String host}) async {
try {
await PrefUtil.setValue<String>('qweatherApiHost', host);
return true;
} catch (e) {
return false;
} finally {
update();
}
}
Future<bool> setTiandituKey({required String key}) async {
try {
await PrefUtil.setValue<String>('tiandituKey', key);

View File

@@ -63,6 +63,21 @@ class LaboratoryPage extends StatelessWidget {
}
},
),
const Gap(12),
QrInputTile(
title: '${context.l10n.labQweather} API Host',
value: PrefUtil.getValue<String>('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',

View File

@@ -42,6 +42,8 @@ class PrefUtil {
'fontTheme',
//和风key
'qweatherKey',
// 和风apihost,
'qweatherApiHost',
'tencentId',
'tencentKey',
'tiandituKey',

View File

@@ -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);
},

View File

@@ -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,