Is there an existing issue for this?
Which plugins are affected?
Zstandard macOS
Which platforms are affected?
macOS
Description
The plugin uses the deprecated zstd API ZSTD_getDecompressedSize() to obtain the decompressed size before calling ZSTD_decompress(). This function has been removed (or is being removed) in newer environments (e.g. macOS 26+), and the zstd documentation recommends using ZSTD_getFrameContentSize() instead.
Proposed solution
- Replace all usages of
ZSTD_getDecompressedSize with ZSTD_getFrameContentSize in the platform implementations (iOS, macOS, Linux, Windows, Android, CLI) and in generated bindings where the API is called from Dart.
- Handle the return values correctly:
ZSTD_getFrameContentSize can return ZSTD_CONTENTSIZE_UNKNOWN and ZSTD_CONTENTSIZE_ERROR in addition to the size; the existing fallback (e.g. compressedSize * 20 when size is not usable) should still apply.
- Do not add or vendor another copy of the zstd library; keep using the existing in-repo zstd sources and build setup. The current codebase already provides
ZSTD_getFrameContentSize; only the call sites need to be updated.
Scope
- Update Dart/FFI call sites that use
ZSTD_getDecompressedSize to use ZSTD_getFrameContentSize and treat unknown/error values appropriately.
- Optionally expose or use the
ZSTD_CONTENTSIZE_* constants in bindings if needed for clearer logic.
- No change to the way zstd is integrated (no new copy of zstd in
Classes or elsewhere).
References
- PR #102 (same goal; this issue tracks a minimal fix without vendoring another zstd copy).
- zstd API:
ZSTD_getFrameContentSize() replaces ZSTD_getDecompressedSize() (see zstd.h in-repo).
Reproducing the issue
Run the macOS sample app.
Flutter Version
3.41.4
Relevant Log Output
Flutter dependencies
Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.
Additional context and comments
No response
Is there an existing issue for this?
Which plugins are affected?
Zstandard macOS
Which platforms are affected?
macOS
Description
The plugin uses the deprecated zstd API
ZSTD_getDecompressedSize()to obtain the decompressed size before callingZSTD_decompress(). This function has been removed (or is being removed) in newer environments (e.g. macOS 26+), and the zstd documentation recommends usingZSTD_getFrameContentSize()instead.Proposed solution
ZSTD_getDecompressedSizewithZSTD_getFrameContentSizein the platform implementations (iOS, macOS, Linux, Windows, Android, CLI) and in generated bindings where the API is called from Dart.ZSTD_getFrameContentSizecan returnZSTD_CONTENTSIZE_UNKNOWNandZSTD_CONTENTSIZE_ERRORin addition to the size; the existing fallback (e.g.compressedSize * 20when size is not usable) should still apply.ZSTD_getFrameContentSize; only the call sites need to be updated.Scope
ZSTD_getDecompressedSizeto useZSTD_getFrameContentSizeand treat unknown/error values appropriately.ZSTD_CONTENTSIZE_*constants in bindings if needed for clearer logic.Classesor elsewhere).References
ZSTD_getFrameContentSize()replacesZSTD_getDecompressedSize()(seezstd.hin-repo).Reproducing the issue
Run the macOS sample app.
Flutter Version
3.41.4
Relevant Log Output
Flutter dependencies
Expand
Flutter dependenciessnippetReplace this line with the contents of your `flutter pub deps -- --style=compact`.Additional context and comments
No response