EphemeralKey.fromJson constructor

EphemeralKey.fromJson(
  1. Map<String, dynamic> json
)

Implementation

EphemeralKey.fromJson(Map<String, dynamic> json) {
  _id = optString(json, FIELD_ID);
  _created = optInteger(json, FIELD_CREATED);
  _expires = optInteger(json, FIELD_EXPIRES);
  _liveMode = optBoolean(json, FIELD_LIVEMODE);
  _customerId = json[FIELD_ASSOCIATED_OBJECTS][0][FIELD_ID];
  _type = json[FIELD_ASSOCIATED_OBJECTS][0][FIELD_TYPE];
  _object = optString(json, FIELD_OBJECT);
  _secret = optString(json, FIELD_SECRET);
  _createdAt = DateTime.fromMillisecondsSinceEpoch(_created);
  _expiresAt = DateTime.fromMillisecondsSinceEpoch(_expires);
}