Event.fromJson constructor

Event.fromJson(
  1. Object? json
)

Implementation

factory Event.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return Event(
    account: map['account'] == null ? null : (map['account'] as String),
    apiVersion:
        map['api_version'] == null ? null : (map['api_version'] as String),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    data: NotificationEventData.fromJson(map['data']),
    id: (map['id'] as String),
    livemode: (map['livemode'] as bool),
    pendingWebhooks: (map['pending_webhooks'] as num).toInt(),
    request:
        map['request'] == null ? null : EventRequest.fromJson(map['request']),
    type: EventType.fromJson(map['type']),
  );
}