EntitlementInfo constructor

const EntitlementInfo(
  1. @JsonKey(name: 'identifier') String identifier,
  2. @JsonKey(name: 'isActive') bool isActive,
  3. @JsonKey(name: 'willRenew') bool willRenew,
  4. @JsonKey(name: 'latestPurchaseDate') String latestPurchaseDate,
  5. @JsonKey(name: 'originalPurchaseDate') String originalPurchaseDate,
  6. @JsonKey(name: 'productIdentifier') String productIdentifier,
  7. @JsonKey(name: 'isSandbox') bool isSandbox, {
  8. @Default(OwnershipType.unknown) @JsonKey(name: 'ownershipType', unknownEnumValue: OwnershipType.unknown) OwnershipType ownershipType,
  9. @Default(Store.unknownStore) @JsonKey(name: 'store', unknownEnumValue: Store.unknownStore) Store store,
  10. @Default(PeriodType.unknown) @JsonKey(name: 'periodType', unknownEnumValue: PeriodType.unknown) PeriodType periodType,
  11. @JsonKey(name: 'expirationDate') String? expirationDate,
  12. @JsonKey(name: 'unsubscribeDetectedAt') String? unsubscribeDetectedAt,
  13. @JsonKey(name: 'billingIssueDetectedAt') String? billingIssueDetectedAt,
})

Implementation

const factory EntitlementInfo(
  /// The entitlement identifier configured in the RevenueCat dashboard
  @JsonKey(name: 'identifier')
      String identifier,

  /// True if the user has access to this entitlement
  @JsonKey(name: 'isActive')
      bool isActive,

  /// True if the underlying subscription is set to renew at the end of
  /// the billing period (expirationDate).
  @JsonKey(name: 'willRenew')
      bool willRenew,

  /// The latest purchase or renewal date for the entitlement.
  @JsonKey(name: 'latestPurchaseDate')
      String latestPurchaseDate,

  /// The first date this entitlement was purchased
  @JsonKey(name: 'originalPurchaseDate')
      String originalPurchaseDate,

  /// The product identifier that unlocked this entitlement
  @JsonKey(name: 'productIdentifier')
      String productIdentifier,

  /// False if this entitlement is unlocked via a production purchase
  @JsonKey(name: 'isSandbox')
      bool isSandbox, {

  /// Use this property to determine whether a purchase was made by the current
  /// user or shared to them by a family member. This can be useful for
  /// onboarding users who have had an entitlement shared with them, but might
  /// not be entirely aware of the benefits they now have.
  @Default(OwnershipType.unknown)
  @JsonKey(
    name: 'ownershipType',
    unknownEnumValue: OwnershipType.unknown,
  )
      OwnershipType ownershipType,

  /// The store where this entitlement was unlocked from
  @Default(Store.unknownStore)
  @JsonKey(
    name: 'store',
    unknownEnumValue: Store.unknownStore,
  )
      Store store,

  /// The last period type this entitlement was in
  @Default(PeriodType.unknown)
  @JsonKey(
    name: 'periodType',
    unknownEnumValue: PeriodType.unknown,
  )
      PeriodType periodType,

  /// The expiration date for the entitlement, can be null for lifetime access.
  /// If the [periodType] is [PeriodType.trial],
  /// this is the trial expiration date.
  @JsonKey(name: 'expirationDate')
      String? expirationDate,

  /// The date an unsubscribe was detected. Can be null if it's still
  /// subscribed or product is not a subscription.
  /// @note: Entitlement may still be active even if user has unsubscribed.
  /// Check the [isActive] property.
  @JsonKey(name: 'unsubscribeDetectedAt')
      String? unsubscribeDetectedAt,

  /// The date a billing issue was detected. Can be null if there is no
  /// billing issue or an issue has been resolved.
  /// @note: Entitlement may still be active even if there is a billing issue.
  /// Check the [isActive] property.
  @JsonKey(name: 'billingIssueDetectedAt')
      String? billingIssueDetectedAt,
}) = _EntitlementInfo;