Skip to content

Commit beac947

Browse files
authored
⬆️ Support package:archive v4 (#635)
## What does this change? Fixes #625 🎯 ## Type of change - [x] New feature (non-breaking change which adds functionality)
1 parent 1aff160 commit beac947

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/core/lib/generators/integrations/lottie_integration.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,14 @@ ${isPackage ? "\n static const String package = '$packageName';" : ''}
124124
}
125125
if (asset.mime == 'application/zip') {
126126
final inputStream = InputFileStream(asset.fullPath);
127-
final archive = ZipDecoder().decodeBuffer(inputStream);
127+
final decoder = ZipDecoder();
128+
Archive archive;
129+
try {
130+
// Compatible with archive v4.
131+
archive = (decoder as dynamic).decodeStream(inputStream);
132+
} on NoSuchMethodError {
133+
archive = (decoder as dynamic).decodeBuffer(inputStream);
134+
}
128135
final jsonFile = archive.files.firstWhereOrNull(
129136
(e) => e.name.endsWith('.json'),
130137
);

packages/core/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies:
2525
glob: ^2.0.0
2626

2727
dart_style: '>=2.2.4 <4.0.0'
28-
archive: ^3.4.0
28+
archive: '>=3.4.0 <5.0.0'
2929
args: ^2.0.0
3030
pub_semver: ^2.0.0
3131
vector_graphics_compiler: ^1.1.9

0 commit comments

Comments
 (0)