From c9b07a9a2a239dd2cd57812b921f5f5e833ef58b Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 14 Sep 2025 17:38:11 +0800 Subject: [PATCH] :bug: Fix errors --- lib/models/auth.dart | 10 ++++---- lib/models/auth.freezed.dart | 50 ++++++++++++++++++------------------ lib/models/auth.g.dart | 10 ++++---- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/lib/models/auth.dart b/lib/models/auth.dart index eaa25707..779d4c72 100644 --- a/lib/models/auth.dart +++ b/lib/models/auth.dart @@ -14,11 +14,11 @@ sealed class AppToken with _$AppToken { @freezed sealed class GeoIpLocation with _$GeoIpLocation { const factory GeoIpLocation({ - required double latitude, - required double longitude, - required String countryCode, - required String country, - required String city, + required double? latitude, + required double? longitude, + required String? countryCode, + required String? country, + required String? city, }) = _GeoIpLocation; factory GeoIpLocation.fromJson(Map json) => diff --git a/lib/models/auth.freezed.dart b/lib/models/auth.freezed.dart index 550b46fa..0e727997 100644 --- a/lib/models/auth.freezed.dart +++ b/lib/models/auth.freezed.dart @@ -272,7 +272,7 @@ as String, /// @nodoc mixin _$GeoIpLocation { - double get latitude; double get longitude; String get countryCode; String get country; String get city; + double? get latitude; double? get longitude; String? get countryCode; String? get country; String? get city; /// Create a copy of GeoIpLocation /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -305,7 +305,7 @@ abstract mixin class $GeoIpLocationCopyWith<$Res> { factory $GeoIpLocationCopyWith(GeoIpLocation value, $Res Function(GeoIpLocation) _then) = _$GeoIpLocationCopyWithImpl; @useResult $Res call({ - double latitude, double longitude, String countryCode, String country, String city + double? latitude, double? longitude, String? countryCode, String? country, String? city }); @@ -322,14 +322,14 @@ class _$GeoIpLocationCopyWithImpl<$Res> /// Create a copy of GeoIpLocation /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? latitude = null,Object? longitude = null,Object? countryCode = null,Object? country = null,Object? city = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? latitude = freezed,Object? longitude = freezed,Object? countryCode = freezed,Object? country = freezed,Object? city = freezed,}) { return _then(_self.copyWith( -latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable -as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable -as double,countryCode: null == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable -as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable -as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable -as String, +latitude: freezed == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable +as double?,longitude: freezed == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable +as double?,countryCode: freezed == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable +as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String?, )); } @@ -411,7 +411,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( double latitude, double longitude, String countryCode, String country, String city)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( double? latitude, double? longitude, String? countryCode, String? country, String? city)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _GeoIpLocation() when $default != null: return $default(_that.latitude,_that.longitude,_that.countryCode,_that.country,_that.city);case _: @@ -432,7 +432,7 @@ return $default(_that.latitude,_that.longitude,_that.countryCode,_that.country,_ /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( double latitude, double longitude, String countryCode, String country, String city) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( double? latitude, double? longitude, String? countryCode, String? country, String? city) $default,) {final _that = this; switch (_that) { case _GeoIpLocation(): return $default(_that.latitude,_that.longitude,_that.countryCode,_that.country,_that.city);} @@ -449,7 +449,7 @@ return $default(_that.latitude,_that.longitude,_that.countryCode,_that.country,_ /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( double latitude, double longitude, String countryCode, String country, String city)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( double? latitude, double? longitude, String? countryCode, String? country, String? city)? $default,) {final _that = this; switch (_that) { case _GeoIpLocation() when $default != null: return $default(_that.latitude,_that.longitude,_that.countryCode,_that.country,_that.city);case _: @@ -467,11 +467,11 @@ class _GeoIpLocation implements GeoIpLocation { const _GeoIpLocation({required this.latitude, required this.longitude, required this.countryCode, required this.country, required this.city}); factory _GeoIpLocation.fromJson(Map json) => _$GeoIpLocationFromJson(json); -@override final double latitude; -@override final double longitude; -@override final String countryCode; -@override final String country; -@override final String city; +@override final double? latitude; +@override final double? longitude; +@override final String? countryCode; +@override final String? country; +@override final String? city; /// Create a copy of GeoIpLocation /// with the given fields replaced by the non-null parameter values. @@ -506,7 +506,7 @@ abstract mixin class _$GeoIpLocationCopyWith<$Res> implements $GeoIpLocationCopy factory _$GeoIpLocationCopyWith(_GeoIpLocation value, $Res Function(_GeoIpLocation) _then) = __$GeoIpLocationCopyWithImpl; @override @useResult $Res call({ - double latitude, double longitude, String countryCode, String country, String city + double? latitude, double? longitude, String? countryCode, String? country, String? city }); @@ -523,14 +523,14 @@ class __$GeoIpLocationCopyWithImpl<$Res> /// Create a copy of GeoIpLocation /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? latitude = null,Object? longitude = null,Object? countryCode = null,Object? country = null,Object? city = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? latitude = freezed,Object? longitude = freezed,Object? countryCode = freezed,Object? country = freezed,Object? city = freezed,}) { return _then(_GeoIpLocation( -latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable -as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable -as double,countryCode: null == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable -as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable -as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable -as String, +latitude: freezed == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable +as double?,longitude: freezed == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable +as double?,countryCode: freezed == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable +as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String?, )); } diff --git a/lib/models/auth.g.dart b/lib/models/auth.g.dart index ce10b664..26808be1 100644 --- a/lib/models/auth.g.dart +++ b/lib/models/auth.g.dart @@ -15,11 +15,11 @@ Map _$AppTokenToJson(_AppToken instance) => { _GeoIpLocation _$GeoIpLocationFromJson(Map json) => _GeoIpLocation( - latitude: (json['latitude'] as num).toDouble(), - longitude: (json['longitude'] as num).toDouble(), - countryCode: json['country_code'] as String, - country: json['country'] as String, - city: json['city'] as String, + latitude: (json['latitude'] as num?)?.toDouble(), + longitude: (json['longitude'] as num?)?.toDouble(), + countryCode: json['country_code'] as String?, + country: json['country'] as String?, + city: json['city'] as String?, ); Map _$GeoIpLocationToJson(_GeoIpLocation instance) =>