file_compression_plus 1.0.0 copy "file_compression_plus: ^1.0.0" to clipboard
file_compression_plus: ^1.0.0 copied to clipboard

Compress images and PDFs in Flutter. Hit an exact target file size, batch compress with progress, convert JPG PNG WebP HEIC, and shrink PDF documents.

1.0.0 #

First stable release. Fixes the plugin declaration that broke consumer builds in every earlier version, and adds the features the package was missing.

Fixes #1.

Upgrading is safe. Nothing you were already calling has changed. See the migration guide.

Fixed #

  • Builds no longer fail with "doesn't have a main class defined". The pubspec.yaml declared this package as a Flutter plugin, naming FileCompressionPlusPlugin for Android, iOS, macOS, Windows and Linux and FileCompressionPlusWeb for web. None of those classes existed. Flutter looked for them at build time and failed. This is a pure Dart package and needs no platform code, so the plugin block is gone along with the dead stubs it pointed at.
  • Compression can no longer hand back a file that is bigger than the one you gave it. That happens with already optimised images and PDFs. The new skipIfLarger flag is on by default and keeps the original instead.
  • PDF errors no longer collapse into a generic Invalid PDF file format exception that hid the real cause. A damaged document throws a FileSystemException carrying the file path.
  • Removed a pointless PdfPage.graphics.save() call on every page during PDF compression. It saved graphics state and did nothing for the output size.
  • Removed an unnecessary copy of the source image into the temporary directory before compression. The encoder reads the source directly.
  • Removed print calls from the library. A package should not write to the console of the app using it.

Added #

  • compressImageToTargetSize compresses until the file fits a byte budget. It binary searches the quality range so you keep the highest quality that still fits, and halves the dimensions when quality alone is not enough.
  • compressBatch compresses a list of files with per-file progress through BatchProgress, and collects per-file errors in BatchCompressionResult instead of failing the whole run.
  • compressImageBytes and compressPdfBytes work on Uint8List without touching the disk, for downloaded or in-memory data.
  • compress routes any supported file to the image or PDF compressor by its extension, for when a picker hands you a file of unknown type.
  • FileCompressor.canCompress, supportedExtensions and supportedImageExtensions for filtering a picker result.
  • ImageFormat.heic for the smallest output on devices that can write it. Throws UnsupportedError elsewhere, so catch it and fall back to JPEG.
  • removeMetadata on the PDF methods clears title, author, subject, keywords, creator and producer.
  • rotate on the image methods turns the image while compressing.
  • outputPath on every method writes the result to an exact path and creates any missing parent folders.
  • keepExif on the image methods keeps camera metadata.
  • CompressionResult reports originalSize, compressedSize, savedBytes, savedPercentage, wasSkipped, readableOriginalSize and readableCompressedSize.
  • formatBytes turns a byte count into something a user can read.
  • Validation for maxWidth and maxHeight, which must be greater than zero.

Changed #

  • Upgraded syncfusion_flutter_pdf from 28.2.7 to 34.2.4 and flutter_image_compress from 2.4.0 to 2.5.1. path is now 1.9.1, path_provider 2.1.6 and flutter_lints 6.0.0.
  • Dropped universal_io and js, which were never imported, and the mockito and build_runner dev dependencies, whose generated mocks file was unused.
  • Minimum SDK raised to Dart 3.6 and Flutter 3.27.
  • Corrected the repository, homepage and issue tracker links, which pointed at a GitHub account that does not host this project.
  • Split the library into lib/src/models.dart and lib/src/file_compressor.dart behind the same single import.

Documentation #

  • Rewrote the README with badges, a platform support table, a full API reference and the error behaviour.
  • Added doc/RECIPES.md with worked solutions for the common jobs, and doc/MIGRATION.md for upgrading from 0.0.x.
  • Added CONTRIBUTING.md. The project is open to contributors, get in touch at hello@tisankan.dev.
  • Added a GitHub Actions workflow that runs analyze, format, tests and pana on every push and pull request, plus issue templates.
  • Rewrote the example app. It now demonstrates single file compression, batch compression with a progress bar, and target size compression.

Tests #

  • 54 tests, all passing. The suite was previously failing 6 of 11 on every run.
  • The PDF fixture is generated at run time. The committed one was not a valid PDF, which is why the PDF tests had been failing.
  • Image compression tests cover argument and file checks only. The encoders are native and cannot run in a plain flutter test process, so the example app covers those paths on a real device.

0.0.5 #

  • Removed web platform support to optimize package size and performance
  • Enhanced native platform implementation
  • Improved code documentation and examples
  • Updated dependencies to latest stable versions
  • Fixed platform-specific configurations
  • Optimized package structure and organization

0.0.4 #

  • Maintenance release

0.0.3 #

  • Maintenance release

0.0.2 #

  • Added comprehensive documentation and examples
  • Improved error handling and resource cleanup
  • Fixed platform configurations in pubspec.yaml
  • Updated Flutter SDK requirement to >=1.20.0
  • Added proper plugin implementation structure

0.0.1 #

  • Initial release of File Compression Plus
  • Added image compression functionality with customizable quality and dimensions
  • Added PDF compression with multiple compression levels
  • Support for JPG, PNG, and WebP image formats
4
likes
160
points
158
downloads

Documentation

Documentation
API reference

Publisher

verified publishertisankan.dev

Weekly Downloads

Compress images and PDFs in Flutter. Hit an exact target file size, batch compress with progress, convert JPG PNG WebP HEIC, and shrink PDF documents.

Repository (GitHub)
View/report issues

Topics

#compression #image #pdf #file #optimization

License

MIT (license)

Dependencies

flutter, flutter_image_compress, path, path_provider, syncfusion_flutter_pdf

More

Packages that depend on file_compression_plus