reusable_editor 0.0.6+2 copy "reusable_editor: ^0.0.6+2" to clipboard
reusable_editor: ^0.0.6+2 copied to clipboard

A modular file editor package for Flutter with support for Firebase and REST API storage, including upload/delete functionality, state management cubits, and UI helpers.

reusable_editor #

A flexible and modular file management package for Flutter, supporting both Firestore and REST API-based storage systems. This package includes file upload/delete operations, state management using Cubits, and various utilities for file/image handling and selection.

Features #

  • Abstract interfaces for clean architecture
  • File upload and delete operations
  • Support for Firebase Firestore and custom REST API
  • Cubits for managing form states (e.g. image, switch, dropdown, text field)
  • Extensions for asset loading as File and Uint8List
  • Enum-based dropdown with icon and label support

Getting Started #

Installation #

Add the following to your pubspec.yaml:

dependencies:
  reusable_editor: <latest_version>

Import #

import 'package:reusable_editor/reusable_editor.dart';

Usage #

File Upload and Delete #

final repository = FileRepositoryFireStorageDataSourceImpl(
  iFireStorageService: YourFireStorageService(),
);

final uploadUseCase = UploadFile(repository);
final deleteUseCase = DeleteFile(repository);

final result = await uploadUseCase.call(fileEntity);
enum FileSourceType { firebase, server }

final dropdown = EnumOptionDropDownMenuFormField<FileSourceType>(
  selectedValue: selectedOption,
  onChanged: (value) => print(value?.type),
  hint: 'Select file source',
  dropdownItems: [
    EnumOptionEntity(type: FileSourceType.firebase, icon: Icons.cloud, label: 'Firebase'),
    EnumOptionEntity(type: FileSourceType.server, icon: Icons.storage, label: 'Server'),
  ],
);

Load Asset as File #

final file = await 'assets/image.png'.loadAsFile();

Load Asset as Bytes #

final bytes = await 'assets/image.png'.loadAssetImage();

State Management Cubits #

  • DateTimeCubit - Manages date selection
  • ImageCrudCubit - Handles image pick logic and validation
  • SelectionCubit<T> - Generic selection for enum dropdown
  • SwitchCubit - Toggle logic
  • TextFieldCubit - Text field validation

Interfaces #

  • IFileRepository - Upload/Delete abstraction
  • IFileDiConst - Dependency constant keys
  • IFileDiFactory - Abstract DI factory

Contributions #

Feel free to open issues or pull requests.

License #

MIT License

0
likes
100
points
159
downloads

Publisher

unverified uploader

Weekly Downloads

A modular file editor package for Flutter with support for Firebase and REST API storage, including upload/delete functionality, state management cubits, and UI helpers.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

bloc, dartz, equatable, exception_type, fire_storage_impl, flutter, flutter_bloc, get_it_di_global_variable, i_tdd, i_validator, navigation_without_context, path_provider, provider, reusable_app_bar, reusable_image_widget

More

Packages that depend on reusable_editor