Scrunch class
Improvements that can be made include:
- Enabling the desired image size output in MB to be determined or assigned
by the person using an instance of the class to implement its methods
This class utilizes the
flutter_image_compress
andflutter_isolate
packages to compress an image in a separate isolate if the size of the image exceeds the desired size.
NOTE: When an instance of this class which calls the compress method is used, it is equally important to call the dispose method in the dispose method of that class, or if used in a try-catch block, be called in the finally-block to terminate the isolate, which could still be running in the background. Though the compress automatically calls the dispose when it has completed its given task, but it is still advisable to call the dispose method in the off-chance that the isolate could still be running
Constructors
- Scrunch()
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
-
compress(
List< File?> files, [int targetSize = 5]) → Future<List< File> ?> - This method will return a List of image files which has been compressed using a Isolate
-
dispose(
) → void - This method terminates the running isolate if it's still active
-
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