Purchase.fromJson constructor

Purchase.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory Purchase.fromJson(Map<String, Object?> json) => Purchase(
  store: PurchaseRecordStore.fromWire(json['store'] as String),
  kind: PurchaseKind.fromWire(json['kind'] as String),
  item: json['item'] as String,
  plan: json['plan'] == null
      ? null
      : PurchasePlan.fromWire(json['plan'] as String),
  amount: (json['amount'] as num?)?.toInt(),
  state: PurchaseState.fromWire(json['state'] as String),
  renews: json['renews'] as bool,
  test: json['test'] as bool,
  startedAt: json['startedAt'] as String,
  endsAt: json['endsAt'] as String?,
);