BillingMeterEvent.fromJson constructor

BillingMeterEvent.fromJson(
  1. Object? json
)

Implementation

factory BillingMeterEvent.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return BillingMeterEvent(
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    eventName: (map['event_name'] as String),
    identifier: (map['identifier'] as String),
    livemode: (map['livemode'] as bool),
    payload: (map['payload'] as Map).cast<String, Object?>().map((
          key,
          value,
        ) =>
            MapEntry(
              key,
              (value as String),
            )),
    timestamp: DateTime.fromMillisecondsSinceEpoch(
        (map['timestamp'] as int).toInt()),
  );
}