InAppGalleryUtils class

Utility class for the in_app_gallery package. Provides methods to handle camera picking, media selection processing, and video/image compression.

Constructors

InAppGalleryUtils()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

progressStream → Stream<double>
Stream of compression progress (0.0 to 1.0)
no setter

Static Methods

compressImage(File file, {int quality = 50}) → Future<File>
Compresses an image and returns the compressed file. Uses native C bicubic compression via BicubicResizer when possible, with automatic fallback to FlutterImageCompress.
compressVideo(File file) → Future<File>
Compresses a video using the native platform implementation via MethodChannel.
formatBytes(int bytes, [int decimals = 2]) → String
Formats byte size into human readable format (e.g. 1.5 MB).
onCameraPicked({required BuildContext context, int? imageQuality, bool isVideo = false}) → Future<File?>
Opens the device camera to take a photo or record a video. Checks for camera permissions first, and shows a settings permission dialog if permanently denied. Returns the picked File or null if the user cancelled or denied permission.
onSelectionCompleted({int? imageQuality, required List<AssetEntity> selectedMedia, Map<String, File>? editedFiles, required bool allowVideoCompression, void onVideoSizeExceeded(String filename)?, void onProgress(int current, int total)?}) → Future<List<File>>
Processes the selected media items from the gallery. Applies image and video compression if configured. Uses editedFiles when available for customized photos. Returns a list of processed Files ready for upload.
resizeAndCompressWithBicubic({required File inputFile, int? outputWidth, int? outputHeight, int? maxWidth, int? maxHeight, int quality = 90, int compressionLevel = 6, BicubicFilter filter = BicubicFilter.catmullRom, EdgeMode edgeMode = EdgeMode.clamp, double crop = 1.0, CropAnchor cropAnchor = CropAnchor.center, CropAspectRatio cropAspectRatio = CropAspectRatio.original, double aspectRatioWidth = 1.0, double aspectRatioHeight = 1.0, bool applyExifOrientation = true}) → Future<File>
Resizes and crops an image file using BicubicResizer with native C performance.