UsageRecord.fromJson constructor

UsageRecord.fromJson(
  1. Object? json
)

Implementation

factory UsageRecord.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return UsageRecord(
    id: (map['id'] as String),
    livemode: (map['livemode'] as bool),
    quantity: (map['quantity'] as num).toInt(),
    subscriptionItem: (map['subscription_item'] as String),
    timestamp: DateTime.fromMillisecondsSinceEpoch(
        (map['timestamp'] as int).toInt()),
  );
}