toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  return {
    'description': description,
    'formatVersion': formatVersion,
    'organizationName': organizationName,
    'passTypeIdentifier': passTypeIdentifier,
    'serialNumber': serialNumber,
    'teamIdentifier': teamIdentifier,
    'webServiceURL': webServiceURL,
    'authenticationToken': authenticationToken,
    'barcodes': barcodes
        ?.map((e) => e.toJson()..removeWhere((_, value) => value == null))
        .toList(),
    'nfc': nfc?.toJson(),
    'backgroundColor': fromColor(backgroundColor),
    'foregroundColor': fromColor(foregroundColor),
    'labelColor': fromColor(labelColor),
    'groupingIdentifier': groupingIdentifier,
    'logoText': logoText,
    'storeCard': storeCard?.toJson()
      ?..removeWhere((_, value) => value == null),
    'generic': generic?.toJson()?..removeWhere((_, value) => value == null),
    'eventTicket': eventTicket?.toJson()
      ?..removeWhere((_, value) => value == null),
    'coupon': coupon?.toJson()?..removeWhere((_, value) => value == null),
    'boardingPass': boardingPass?.toJson()
      ?..removeWhere((_, value) => value == null),
    'locations': locations
        ?.map((e) => e.toJson()..removeWhere((_, value) => value == null))
        .toList(),
    'maxDistance': maxDistance,
    'relevantDate': relevantDate,
    'associatedStoreIdentifiers': associatedStoreIdentifiers,
    'appLaunchURL': appLaunchURL,
    'expirationDate': expirationDate,
    'voided': voided,
    'sharingProhibited': sharingProhibited,
  };
}