Skip to content

Commit

Permalink
fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
ueman committed Sep 18, 2024
1 parent a4e6236 commit 6c004b5
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions passkit/lib/src/pkpass/pkpass.dart
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ class PkPass {
/// that look odd and wrong in Apple wallet or [passkit_ui](https://pub.dev/packages/passkit_ui)
@experimental
Uint8List? write({
required String certificatePem,
required String privateKeyPem,
String? certificatePem,
String? privateKeyPem,
}) {
final archive = Archive();
final encoder = JsonEncoder.withIndent(' ');
Expand Down Expand Up @@ -315,18 +315,20 @@ class PkPass {
);
archive.addFile(manifestFile);

final signature = writeSignature(
certificatePem,
privateKeyPem,
Uint8List.fromList(manifestFile.content as List<int>),
);
if (certificatePem != null && privateKeyPem != null) {
final signature = writeSignature(
certificatePem,
privateKeyPem,
Uint8List.fromList(manifestFile.content as List<int>),
);

final signatureFile = ArchiveFile(
'signature',
signature.length,
signature,
);
archive.addFile(signatureFile);
final signatureFile = ArchiveFile(
'signature',
signature.length,
signature,
);
archive.addFile(signatureFile);
}

final pkpass = ZipEncoder().encode(archive);
if (pkpass == null) {
Expand Down

0 comments on commit 6c004b5

Please sign in to comment.