mirror of
https://gitlab.com/TheOneWithTheBraid/dart_pkpass.git
synced 2025-07-05 12:58:47 +00:00
chore: initial commit
Signed-off-by: The one with the braid <the-one@with-the-braid.cf>
This commit is contained in:
commit
cf9609d699
20 changed files with 1483 additions and 0 deletions
27
example/pkpass_example.dart
Normal file
27
example/pkpass_example.dart
Normal file
|
@ -0,0 +1,27 @@
|
|||
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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue