BillingMeterEventCreateOptions.fromJson constructor

BillingMeterEventCreateOptions.fromJson(
  1. Object? json
)

Implementation

factory BillingMeterEventCreateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return BillingMeterEventCreateOptions(
    eventName: (map['event_name'] as String),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    identifier:
        map['identifier'] == null ? null : (map['identifier'] as String),
    payload: (map['payload'] as Map).cast<String, Object?>().map((
          key,
          value,
        ) =>
            MapEntry(
              key,
              (value as String),
            )),
    timestamp: DateTime.fromMillisecondsSinceEpoch(
        (map['timestamp'] as int).toInt()),
  );
}