getLatestVersion method
Getting the Latest Version of a Pass
Requests the latest version of the current PkPass file
modifiedSince
should be provided in order to support "304 Not Modified"
Implementation
Future<Uint8List?> getLatestVersion([DateTime? modifiedSince]) async {
final identifier = metadata.passTypeIdentifier;
final serial = metadata.serialNumber;
final endpoint = '/$_apiVersion/passes/$identifier/$serial';
final response = await httpClient.get(
Uri.parse(webService.webServiceURL.toString() + endpoint),
headers: {
if (modifiedSince != null)
'If-Modified-Since': HttpDate.format(modifiedSince),
'Authorization': 'ApplePass ${webService.authenticationToken}',
},
);
switch (response.statusCode) {
case 200:
return response.bodyBytes;
case 304:
return null;
default:
throw WebServiceResponseError(response);
}
}