cunning_document_scanner 2.8.0
cunning_document_scanner: ^2.8.0 copied to clipboard
A document scanner plugin for flutter. Scan and crop automatically on iOS and Android.
2.8.0 #
iOS #
- Added document image filter options (Original, Color, Grayscale, B&W) to the custom document cropper (
CunningDocumentCropperViewController) when importing images from the gallery, achieving feature parity with Android ML Kit (fixes #153).
2.7.0 #
General #
- Added
CunningDocumentScanner.cleanCache()to clear temporary scanned images and generated PDF files from local storage. - Enforced
noOfPagespage limit validation in Dart (noOfPages > 0), throwing anArgumentErrorwhen invalid values are supplied. - Documented exception handling for
ArgumentErrorandCunningDocumentScannerExceptionin DartDoc comments andREADME.md.
iOS #
- Added manual document cropper for gallery-imported images (
ScannerSource.gallery), resolving the limitation where gallery images could not be manually cropped before export. - Implemented
noOfPageslimit handling in bothPHPickerViewControllerselection limit andVNDocumentCameraViewController. - Implemented native
cleanCachesupport. - Implemented a circular
MagnifierViewprecision zoom lens centered over handles during touch dragging, providing pixel-perfect corner positioning. - Added a cancel confirmation dialog to prevent accidental data loss in multi-page scanning.
- Fixed rotate button behavior to properly map cropping coordinates 90 degrees clockwise without losing user progress.
- Optimized image loading and processing:
- Offloaded heavy image orientation fixes (
fixedOrientation()) and perspective correction filters to background threads. - Wrapped background processing calls in
autoreleasepoolblocks to force immediate memory deallocation and avoid OOM crashes. - Downscaled imported gallery images to a maximum of 2048px on load to prevent concurrent memory spikes.
- Replaced CPU-intensive rotation with instant metadata orientation changes.
- Offloaded heavy image orientation fixes (
- Added translations for the new cropper discard options across all 29 localized languages.
Android #
- Implemented native
cleanCachesupport purgingDOCUMENT_SCAN_files fromcacheDirandPICTURESdirectory.
2.6.0 #
Android #
- Removed HMS (Huawei Mobile Services) support entirely to ensure 16 KB page-size compatibility on Android 15+ (fixes #146).
- Replaced deprecated
getParcelable(key)with type-safeandroidx.core.os.BundleCompat.getParcelablefor Android 13+ compatibility. - Migrated the legacy
androidblock to the modernconfigure<LibraryExtension>block and updated conditional Kotlin plugin application inbuild.gradle.ktsto resolve build/deprecation warnings. - Removed redundant and deprecated
sourceSetsblock, as Kotlin source directories are resolved automatically by Gradle.
2.5.0 #
General #
- Introduced
ScannerSourceenum to specify the source of document images:camera,gallery, orcameraAndGallery. - Deprecated
isGalleryImportAllowedin favor ofscannerSource. IfscannerSourceis provided, it takes precedence andisGalleryImportAllowedis ignored.
Android #
- Added automatic document edge detection for Huawei Mobile Services (HMS) devices using HMS ML Kit Document Skew Correction.
- Fixed a crash/restart loop issue on older GMS+HMS dual-service devices (such as Honor 8X and Huawei P30 Lite) by bypassing GMS and launching the fallback scanner directly on HMS-enabled devices.
- Added direct gallery selection support. When
ScannerSource.galleryis chosen, the system launches the device's image picker and routes the selected image directly to the fallback crop editor (DocumentScannerActivity) for edge adjustment and perspective correction.
iOS #
- Integrated direct gallery picker navigation. When
ScannerSource.galleryis chosen, the plugin opens the native photo library (PHPickerViewController) directly, bypassing the alert/choice menu.
2.4.0 #
General #
- Added cross-platform support for native PDF export. Call
CunningDocumentScanner.getPictures(asPdf: true)to return a list containing a single path pointing to the generated PDF.
Android #
- Removed redundant camera and storage permissions from
AndroidManifest.xml. - Android no longer prompts the user for camera or storage permissions at runtime since ML Kit and the fallback camera intent handle them without requiring permission in the host app.
- Integrated native PDF support in both the Google Play Services ML Kit Document Scanner and the local low-RAM fallback scanner (using built-in
PdfDocument). - Migrated to "Built-in Kotlin" support, removing manual Kotlin Gradle Plugin (KGP) application for future Flutter compatibility.
- Updated Gradle wrapper to
8.14.5. - Updated Android Gradle Plugin (AGP) to
8.13.1. - Updated Kotlin version to
2.2.21.
iOS #
- Camera permission request remains active and required for iOS VisionKit.
- Integrated native PDF compilation using
PDFKit(converting VisionKit scan pages into a single PDF document). - Added native support for
isGalleryImportAllowedon iOS. Users can now choose to scan using the camera (VisionKit) or import existing documents from their photo library (PHPickerViewControlleron iOS 14+ supporting multi-selection, andUIImagePickerControlleron iOS 13). Imported images undergo the same native PDF/image conversion pipeline. - Added native localization support supporting 29 major languages for the iOS source selection Action Sheet and VisionKit interface. Included explicit color themes using KVC to guarantee text visibility across custom dark/light themes.
2.3.0 #
Android #
- Upgraded Gradle wrapper to version
8.14.5. - Modernized Kotlin configuration to use the new
compilerOptionsDSL instead of legacykotlinOptions. - Cleaned up legacy build script configurations, removing deprecated dependencies (
kotlin-stdlib-jdk7) and applying standard Kotlin DSL configurations.
2.2.0 #
Android #
- Added support for configuring the ML Kit document scanner mode.
- Added
AndroidScannerModeenum (full,base,baseWithFilter) to choose between different scanning pipelines.
2.1.0 #
General #
- Bumped Dart SDK constraint to
>=3.5.0 <4.0.0. - Bumped Flutter SDK constraint to
>=3.24.0. - Upgraded
permission_handlerto^12.0.3. - Upgraded
flutter_lintsconstraint to^6.0.0. - Moved
permission_handler_platform_interfacetodev_dependencies. - Modernized Flutter code syntax.
- Added launch configurations for VS Code.
iOS #
- Migrated the iOS plugin to Swift Package Manager (SPM) for modern Flutter integration.
- Reorganized the iOS directory structure under
ios/cunning_document_scanner/and addedPackage.swift. - Renamed
SwiftCunningDocumentScannerPlugintoCunningDocumentScannerPlugin.
2.0.0 #
Breaking Changes #
- Reorganized library structure: all implementation files moved to
lib/src/directory. - Renamed
ios_options.darttoios_scanner_options.dartfor better clarity. - Separated
IosImageFormatenum into its own file (ios_image_format.dart).
Improvements #
- Added custom exception
CunningDocumentScannerExceptionwith specific error codes. - Replaced generic
ExceptionwithCunningDocumentScannerException.permissionDenied()for better error handling. - Improved code organization with barrel exports - users only need a single import.
- Added comprehensive unit tests for custom exceptions.
- Enhanced equality operators for
CunningDocumentScannerException.
Migration Guide #
- No changes required for users - the public API remains the same with
import 'package:cunning_document_scanner/cunning_document_scanner.dart'; - If catching exceptions, update catch blocks to use
CunningDocumentScannerExceptioninstead of genericException.
1.4.0 #
General #
- Bumped
permission_handlerto12.0.1. - Updated the example app to use Kotlin
2.2.21, Android Gradle Plugin8.13.1, and Gradle8.13. - Added detailed documentation comments to the
CunningDocumentScannerclass.
Android #
- Upgraded
play-services-mlkit-document-scannerto16.0.0. - Updated
compileSdkto34.
1.3.1 #
- Upgraded dependencies.
1.3.0 #
- Allow users to configure the image output type on iOS (PNG or JPEG).
1.2.3 #
- Fix iOS crash where Documentscanner is not available
1.2.2 #
- Fix bitmap exception crash on Android (thanks to rosenberg_ptr)
1.2.1 #
- Add fallback for Android devices < 1.7GB RAM
1.2.0 #
- Use ML kit on Android
- dropped nocrop support
- image quality dropped
1.1.5 #
- Nmed parameters
- crop default is false
- dependencies updated
- min ios version 12 now
1.1.4 #
- Fixed iOS permission issue in example
- upgraded permission_handler
1.1.3 #
- Fixed permanently denied permission issue
- Merged crop option for android - Thanks Edwin
1.1.2 #
- iOS return unique filenames
1.1.1 #
- Updated android documentscanner library
1.1.0 #
- Exchanged android documentscanner with https://github.com/WebsiteBeaver/android-document-scanner
1.0.4 #
- Fixed conflicting requestcodes issue
1.0.3 #
- Updated permission handler constraint to ^10
- Android fixed nullsafe access issues
1.0.2 #
- Cleanup code - added images to README.md
1.0.1 #
- Fixed Playstore issue exported activity. Added documentation.
1.0.0 #
- Android and iOs Documentscanner based on Visionkit and AndroidDocument https://github.com/mayuce/AndroidDocumentScanner