image_uploader 0.0.7 copy "image_uploader: ^0.0.7" to clipboard
image_uploader: ^0.0.7 copied to clipboard

A modular and extensible Dart package for uploading and deleting images using Firebase Storage or REST APIs. Built with clean architecture principles and easy-to-integrate dependency injection support.

image_uploader #

image_uploader is a modular and extensible Dart package that simplifies file upload and deletion processes using either Firebase Storage or a REST API-based service. Built with dependency injection and clean architecture principles, this package is designed to integrate easily into your Flutter backend logic.


Features #

  • Upload files to Firebase Storage or a REST API.
  • Delete files from Firebase Storage or REST API.
  • Encapsulated FileEntity and FileResponseEntity models.
  • Clean separation of concerns via repositories and services.
  • Plug-and-play registration using get_it.

Getting Started #

Installation #

Add the following to your pubspec.yaml:

dependencies:
  image_uploader: <latest_version>

Then run:

flutter pub get

Usage #

Dependency Injection Setup #

Choose your data source by passing ImageUploaderSource enum to the fileRegisterGetItDi() function:

Firebase Storage

fileRegisterGetItDi(ImageUploaderSource.firebase);

REST API

fileRegisterGetItDi(ImageUploaderSource.restApi);

Use Cases #

final uploadFile = sl<UploadFile>();
final deleteFile = sl<DeleteFile>();

final fileEntity = FileEntity(
  file: file,
  fileName: 'example.jpg',
  fileType: 'image',
  path: 'user_uploads',
);

final result = await uploadFile(fileEntity);

Models #

FileEntity #

class FileEntity {
  final File? file;
  final Uint8List? bytes;
  final String? path;
  final String? fileName;
  final String? fileType;
  final String? uploadingToastTxt;
}

FileResponseEntity #

class FileResponseEntity {
  final String? fileName;
  final String? imgUrl;
}

Interfaces #

IFileRepository #

abstract class IFileRepository {
  Future<Either<IFailure, String>> uploadFile(FileEntity fileEntity);
  Future<Either<IFailure, bool>> deleteFile(String imgUrl);
}

Customization #

Implement your own IFileRepository, IFireStorageService, or IImageServiceRestApiDataSource to customize how uploading/deleting is handled.


Requirements #

  • Firebase setup (if using Firebase Storage)
  • dartz, exception_type, i_tdd for result handling and abstractions

License #

MIT License. See LICENSE file for details.


Maintainers #

Developed and Maintained with ❤️ by Shohidul Islam. Contributions welcome!

0
likes
150
points
13
downloads

Publisher

unverified uploader

Weekly Downloads

A modular and extensible Dart package for uploading and deleting images using Firebase Storage or REST APIs. Built with clean architecture principles and easy-to-integrate dependency injection support.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

cross_file, dartz, equatable, exception_type, fire_storage_impl, flutter, get_it_di_global_variable, i_tdd, rest_api_impl

More

Packages that depend on image_uploader