saveFromUri method
Implementation
Future<PasskitFile> saveFromUri({
required String id,
required String url,
}) async {
Directory directory = await fs.createDirectory(name: directoryName);
final file = File('${directory.path}/$id.pkpass')..createSync();
directory = Directory(Path.withoutExtension(file.path));
final response = await Dio().download(url, file.path);
if (response.statusCode != 200) {
throw new Exception('Unable to download passkit');
}
await fs.unpack(path: file.path);
final passkitFile = File('${directory.path}/pass.json');
if (!passkitFile.existsSync()) throw Exception('Missing pass.json');
return Parser(
id: id,
directory: directory,
file: file,
passFile: passkitFile,
).parse();
}