PassMetadata.fromJson constructor
Implementation
factory PassMetadata.fromJson(Map<String, Object?> json) => PassMetadata(
description: json['description'] as String,
formatVersion: json['formatVersion'] as int,
organizationName: json['organizationName'] as String,
passTypeIdentifier: json['passTypeIdentifier'] as String,
serialNumber: json['serialNumber'] as String,
teamIdentifier: json['teamIdentifier'] as String,
boardingPass: json['boardingPass'] == null
? null
: PassStructureDictionary.fromJson(
(json['boardingPass'] as Map).cast<String, Object?>(),
),
coupon: json['coupon'] == null
? null
: PassStructureDictionary.fromJson(
(json['coupon'] as Map).cast<String, Object?>(),
),
eventTicket: json['eventTicket'] == null
? null
: PassStructureDictionary.fromJson(
(json['eventTicket'] as Map).cast<String, Object?>(),
),
generic: json['generic'] == null
? null
: PassStructureDictionary.fromJson(
(json['generic'] as Map).cast<String, Object?>(),
),
storeCard: json['storeCard'] == null
? null
: PassStructureDictionary.fromJson(
(json['storeCard'] as Map).cast<String, Object?>(),
),
barcodes: (json['barcodes'] as List? ??
[if (json['barcode'] != null) json['barcode']])
.map((i) => PassBarcode.fromJson(i))
.toList(),
locations: (json['locations'] as List? ?? [])
.map((i) => Location.fromJson(i))
.toList(),
appLaunchURL: json['appLaunchURL'] as String?,
expirationDate:
MaybeDecode.maybeDateTime(json['expirationDate'] as String?),
voided: json['voided'] as bool? ?? false,
beacons: (json['beacons'] as List? ?? [])
.map((i) => Beacon.fromJson(i))
.toList(),
maxDistance: json['maxDistance'] as int?,
relevantDate:
MaybeDecode.maybeDateTime(json['relevantDate'] as String?),
backgroundColor:
MaybeDecode.maybeColor(json['backgroundColor'] as String?),
foregroundColor:
MaybeDecode.maybeColor(json['foregroundColor'] as String?),
groupingIdentifier: json['locoText'] as String?,
labelColor: MaybeDecode.maybeColor(json['labelColor'] as String?),
logoText: json['locoText'] as String?,
webService: PassWebService.maybe(
authenticationToken: json['authenticationToken'] as String?,
webServiceURL: json['webServiceURL'] as String?,
),
);