RhUtils class

This is a RhUtils class containing utility methods for file handling and cloud uploads. To use the class, simply create an instance of RhUtils and call the desired method with the necessary parameters.

Example usage:

Create an instance of RhUtils

final RhUtils utils = RhUtils.instance;

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

cloudinaryUpload({required List<String> paths, required String uploadPreset, required String cloudName, void onProgress(int, int)?, dynamic onException(CloudinaryException)?}) → void
Uploads one or more image files to Cloudinary using the specified upload preset and cloud name.
compressFile({required File? file}) Future<File?>
Compresses a file either by reducing image quality or resizing it for image, or by compressing a video.
compressImage({required File? image, int quality = 100, int percentage = 30}) Future<File?>
Compresses the given image file using FlutterNativeImage plugin and returns the compressed file as a File object.
compressVideo({required File? video, RhVideoQuality? videoQuality, bool deleteOrigin = false, bool? includeAudio, int frameRate = 30, int? duration}) Future<File?>
Compresses the given video file using the provided options.
cropImage({required File imageFile, required BuildContext context, AndroidUiSettings? androidUiSettings, IOSUiSettings? iosUiSettings}) Future<File?>
Crops an image from the provided imageFile using the ImageCropper package.
getFileFromUrl({required String source}) Future<List<File?>>
Downloads file from the given source URL and saves it to a temporary directory on the device.
getFileSize(String filepath) Future<String>
getLastSplit({required String input}) String
Gets last string after splitting input whole by '/'
multiPartProgress({required StreamedResponse response}) Stream<double>
multiPartProgress Returns a stream of the multipart progress for the given HTTP response.
multipartUpload({Map<String, String>? headers, Map<String, String>? body, required Map<String, List<String>> files, required String url, required String method}) Future<StreamedResponse?>
CRUD over List
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pickFilesFromDevice({required bool allowMultiple, required FileType fileType, required List<String> allowedExtensions}) Future<List<File?>>
Returns a list of File objects selected from device using file picker.
pickImagesFromDevice({required ImageSource source, CameraDevice? preferredCameraDevice}) Future<List<File?>>
Returns a human-readable string representation of the size of the specified file in bytes, using the filesize package. If the File is null, the method returns an empty string. pickImagesFromDevice Launches image picker to allow user to select one or multiple images from their device
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance RhUtils
final