EntitlementModel class abstract

JSON shape returned by the public.current_entitlements() RPC.

json_serializable is configured with field_rename: snake in build.yaml, so Dart camelCase names map automatically to snake_case JSON keys.

Available extensions
Annotations

Constructors

EntitlementModel({required String plan, required String source, DateTime? expiresAt, DateTime? trialExpiresAt, DateTime? trialStartedAt, @Default(<String, dynamic>{}) Map<String, dynamic> entitlements, @Default(<String>[]) List<String> grantsApplied, required EntitlementAiModel ai})
const
factory
EntitlementModel.fromJson(Map<String, dynamic> json)
factory

Properties

ai EntitlementAiModel
no setterinherited
copyWith → $EntitlementModelCopyWith<EntitlementModel>
Create a copy of EntitlementModel with the given fields replaced by the non-null parameter values.
no setterinherited
entitlements Map<String, dynamic>
no setterinherited
expiresAt DateTime?
no setterinherited
grantsApplied List<String>
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
plan String
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source String
no setterinherited
trialExpiresAt DateTime?
no setterinherited
trialStartedAt DateTime?
no setterinherited

Methods

map<TResult extends Object?>(TResult $default(_EntitlementModel value)) → TResult

Available on EntitlementModel, provided by the EntitlementModelPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>(TResult? $default(_EntitlementModel value)?) → TResult?

Available on EntitlementModel, provided by the EntitlementModelPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>(TResult $default(_EntitlementModel value)?, {required TResult orElse()}) → TResult

Available on EntitlementModel, provided by the EntitlementModelPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>(TResult $default(String plan, String source, DateTime? expiresAt, DateTime? trialExpiresAt, DateTime? trialStartedAt, Map<String, dynamic> entitlements, List<String> grantsApplied, EntitlementAiModel ai)?, {required TResult orElse()}) → TResult

Available on EntitlementModel, provided by the EntitlementModelPatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toEntity() Entitlement
toJson() Map<String, dynamic>
Serializes this EntitlementModel to a JSON map.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>(TResult $default(String plan, String source, DateTime? expiresAt, DateTime? trialExpiresAt, DateTime? trialStartedAt, Map<String, dynamic> entitlements, List<String> grantsApplied, EntitlementAiModel ai)) → TResult

Available on EntitlementModel, provided by the EntitlementModelPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>(TResult? $default(String plan, String source, DateTime? expiresAt, DateTime? trialExpiresAt, DateTime? trialStartedAt, Map<String, dynamic> entitlements, List<String> grantsApplied, EntitlementAiModel ai)?) → TResult?

Available on EntitlementModel, provided by the EntitlementModelPatterns extension

A variant of when that fallback to returning null

Operators

operator ==(Object other) bool
The equality operator.
inherited