diff --git a/lib/src/dto/eligibility.dart b/lib/src/dto/eligibility.dart index a8d2829e..a9685557 100644 --- a/lib/src/dto/eligibility.dart +++ b/lib/src/dto/eligibility.dart @@ -13,7 +13,7 @@ enum QEligibilityStatus { eligible, } -@JsonSerializable() +@JsonSerializable(createToJson: false) class QEligibility { @JsonKey(name: "status", defaultValue: QEligibilityStatus.unknown) final QEligibilityStatus status; diff --git a/lib/src/dto/eligibility.g.dart b/lib/src/dto/eligibility.g.dart index cb02822e..64ed96ef 100644 --- a/lib/src/dto/eligibility.g.dart +++ b/lib/src/dto/eligibility.g.dart @@ -13,11 +13,6 @@ QEligibility _$QEligibilityFromJson(Map json) { ); } -Map _$QEligibilityToJson(QEligibility instance) => - { - 'status': _$QEligibilityStatusEnumMap[instance.status], - }; - K _$enumDecode( Map enumValues, Object? source, { diff --git a/lib/src/dto/launch_mode.dart b/lib/src/dto/launch_mode.dart index 038fa2f4..c0b70b09 100644 --- a/lib/src/dto/launch_mode.dart +++ b/lib/src/dto/launch_mode.dart @@ -1,5 +1,3 @@ -import 'package:json_annotation/json_annotation.dart'; - enum QLaunchMode { analytics, subscriptionManagement, diff --git a/lib/src/dto/screen_presentation_config.dart b/lib/src/dto/screen_presentation_config.dart index 8c0b83bd..f5ca7431 100644 --- a/lib/src/dto/screen_presentation_config.dart +++ b/lib/src/dto/screen_presentation_config.dart @@ -3,7 +3,7 @@ import 'screen_presentation_style.dart'; part 'screen_presentation_config.g.dart'; -@JsonSerializable() +@JsonSerializable(createFactory: false) class QScreenPresentationConfig { /// Describes how screens will be displayed. /// For mode details see the enum description. diff --git a/lib/src/dto/screen_presentation_config.g.dart b/lib/src/dto/screen_presentation_config.g.dart index a6dc1234..e2f5552f 100644 --- a/lib/src/dto/screen_presentation_config.g.dart +++ b/lib/src/dto/screen_presentation_config.g.dart @@ -6,14 +6,6 @@ part of 'screen_presentation_config.dart'; // JsonSerializableGenerator // ************************************************************************** -QScreenPresentationConfig _$QScreenPresentationConfigFromJson( - Map json) { - return QScreenPresentationConfig( - _$enumDecode(_$QScreenPresentationStyleEnumMap, json['presentationStyle']), - json['animated'] as bool, - ); -} - Map _$QScreenPresentationConfigToJson( QScreenPresentationConfig instance) => { @@ -22,32 +14,6 @@ Map _$QScreenPresentationConfigToJson( 'animated': animatedToJson(instance.animated), }; -K _$enumDecode( - Map enumValues, - Object? source, { - K? unknownValue, -}) { - if (source == null) { - throw ArgumentError( - 'A value must be provided. Supported values: ' - '${enumValues.values.join(', ')}', - ); - } - - return enumValues.entries.singleWhere( - (e) => e.value == source, - orElse: () { - if (unknownValue == null) { - throw ArgumentError( - '`$source` is not one of the supported values: ' - '${enumValues.values.join(', ')}', - ); - } - return MapEntry(unknownValue, enumValues.values.first); - }, - ).key; -} - const _$QScreenPresentationStyleEnumMap = { QScreenPresentationStyle.push: 'Push', QScreenPresentationStyle.fullScreen: 'FullScreen', diff --git a/lib/src/dto/sku_details/sku_details.dart b/lib/src/dto/sku_details/sku_details.dart index d5d131bc..dbb0fbd8 100644 --- a/lib/src/dto/sku_details/sku_details.dart +++ b/lib/src/dto/sku_details/sku_details.dart @@ -1,7 +1,5 @@ // Copyright 2019 The Chromium Authors. All rights reserved. -import 'dart:ui' show hashValues; - import 'package:json_annotation/json_annotation.dart'; part 'sku_details.g.dart'; @@ -112,29 +110,28 @@ class SkuDetailsWrapper { return false; } - final SkuDetailsWrapper typedOther = other; - return typedOther is SkuDetailsWrapper && - typedOther.description == description && - typedOther.freeTrialPeriod == freeTrialPeriod && - typedOther.introductoryPrice == introductoryPrice && - typedOther.introductoryPriceAmountMicros == + return other is SkuDetailsWrapper && + other.description == description && + other.freeTrialPeriod == freeTrialPeriod && + other.introductoryPrice == introductoryPrice && + other.introductoryPriceAmountMicros == introductoryPriceAmountMicros && - typedOther.introductoryPriceCycles == introductoryPriceCycles && - typedOther.introductoryPricePeriod == introductoryPricePeriod && - typedOther.price == price && - typedOther.priceAmountMicros == priceAmountMicros && - typedOther.sku == sku && - typedOther.subscriptionPeriod == subscriptionPeriod && - typedOther.title == title && - typedOther.type == type && - typedOther.originalPrice == originalPrice && - typedOther.originalPriceAmountMicros == originalPriceAmountMicros && - typedOther.originalJson == originalJson; + other.introductoryPriceCycles == introductoryPriceCycles && + other.introductoryPricePeriod == introductoryPricePeriod && + other.price == price && + other.priceAmountMicros == priceAmountMicros && + other.sku == sku && + other.subscriptionPeriod == subscriptionPeriod && + other.title == title && + other.type == type && + other.originalPrice == originalPrice && + other.originalPriceAmountMicros == originalPriceAmountMicros && + other.originalJson == originalJson; } @override int get hashCode { - return hashValues( + return Object.hash( description.hashCode, freeTrialPeriod.hashCode, introductoryPrice.hashCode, diff --git a/lib/src/dto/user.dart b/lib/src/dto/user.dart index 06f18529..ed3b6d8d 100644 --- a/lib/src/dto/user.dart +++ b/lib/src/dto/user.dart @@ -2,7 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; part 'user.g.dart'; -@JsonSerializable() +@JsonSerializable(createToJson: false) class QUser { @JsonKey(name: "qonversionId") final String qonversionId; diff --git a/lib/src/dto/user.g.dart b/lib/src/dto/user.g.dart index add22fb4..485f259f 100644 --- a/lib/src/dto/user.g.dart +++ b/lib/src/dto/user.g.dart @@ -12,8 +12,3 @@ QUser _$QUserFromJson(Map json) { json['identityId'] as String, ); } - -Map _$QUserToJson(QUser instance) => { - 'qonversionId': instance.qonversionId, - 'identityId': instance.identityId, - };