A Dart native pkpass parsing library.
Find a file
The one with the braid cf9609d699 chore: initial commit
Signed-off-by: The one with the braid <the-one@with-the-braid.cf>
2023-08-26 23:05:51 +02:00
.idea chore: initial commit 2023-08-26 23:05:51 +02:00
example chore: initial commit 2023-08-26 23:05:51 +02:00
lib chore: initial commit 2023-08-26 23:05:51 +02:00
test chore: initial commit 2023-08-26 23:05:51 +02:00
.gitignore chore: initial commit 2023-08-26 23:05:51 +02:00
analysis_options.yaml chore: initial commit 2023-08-26 23:05:51 +02:00
CHANGELOG.md chore: initial commit 2023-08-26 23:05:51 +02:00
LICENSE chore: initial commit 2023-08-26 23:05:51 +02:00
pkpass.iml chore: initial commit 2023-08-26 23:05:51 +02:00
pubspec.yaml chore: initial commit 2023-08-26 23:05:51 +02:00
README.md chore: initial commit 2023-08-26 23:05:51 +02:00

pkpass

A Dart native pkpass parsing library

Features

  • no platform specific dependencies - pure Dart
  • parse any .pkpass file as blob
  • extract metadata
  • high level lookup for assets by locale and scale, with proper fallbacks

Getting started

import 'dart:io';

import 'package:intl/locale.dart';
import 'package:pkpass/pkpass.dart';

Future<int> main(List<String> args) async {
  print('Using first argument or stdin file name: ');
  final path = args.singleOrNull ?? stdin.readLineSync();
  if (path == null || path.isEmpty) {
    print('Please enter a file name or provide it as single argument.');
    return 1;
  }

  final file = File(path);
  final contents = await file.readAsBytes();

  final pass = await PassFile.parse(contents);

  final logo = pass.getLogo(
    scale: 2,
    locale: Locale.fromSubtags(languageCode: 'fr'),
  );

  print('Logo image blob length: ${logo?.length}');

  return 0;
}

Additional information

License : EUPL-1.2