NupaleSession.fromJSON constructor

NupaleSession.fromJSON(
  1. dynamic json
)

Create a NupaleSession object from a JSON map.

Implementation

factory NupaleSession.fromJSON(json) {
  return NupaleSession(
    id: json['id'] ?? '',
    itemId: json['itemId'] ?? '',
    itemName: json['itemName'] ?? '',
    ownerEmail: json['ownerEmail'] ?? json['ownerId'] ?? '',
    readerEmail: json['readerEmail'] ?? json['readerId'] ?? '',
    pagesDuration: (json['pagesDuration'] != null)
        ? (json['pagesDuration'] as Map).map((key, value) => MapEntry(int.parse(key), value))
        : {},
    nupale: json['nupale'] ?? 0,
    createdTime: json['createdTime'] ?? 0,
    subscriptionLevel: EnumToString.fromString(SubscriptionLevel.values, json["subscriptionLevel"].toString()),
    isTest: json['isTest'] ?? false,
  );
}