fire_storage_impl 0.0.5+1
fire_storage_impl: ^0.0.5+1 copied to clipboard
A lightweight Firebase Storage implementation for Flutter apps with support for file upload, deletion, toast notifications, and localization.
fire_storage_impl #
A lightweight Dart/Flutter package for simplified Firebase Storage file uploading and deletion, supporting both mobile and web platforms. It includes toast notifications and localized error messages via a translator service.
Features #
- Upload image files (
File
orUint8List
) to Firebase Storage - Delete uploaded files from Firebase Storage
- Toast message integration using
app_toast
- Context-free localization support via
.translateWithoutContext()
- Automatic file name generation when not provided
Installation #
Add this to your pubspec.yaml
:
dependencies:
fire_storage_impl: <latest_version>
Then run:
flutter pub get
Usage #
Upload a File (Mobile or Web) #
final fireStorage = FireStorageServiceImpl();
String? downloadUrl = await fireStorage.uploadFile(
file,
fileName: 'example_image',
collectionPath: 'user_uploads',
uploadingToastTxt: 'Uploading...',
);
Delete a File #
bool success = await fireStorage.deleteFile(
imgUrl: downloadUrl!,
successTxt: 'Deleted successfully',
);
Upload Uint8List (e.g. Web image picker) #
final imageData = Uint8List.fromList([...]);
final downloadUrl = await imageData.uploadToFirebaseStorage(
fileName: 'web_image.jpeg',
collectionPath: 'web_uploads',
);
File Model (Optional) #
Use FileModel
to pass file data in a structured format:
final fileModel = FileModel(
file: file,
fileName: 'my_image',
fileType: 'Images',
collectionPath: 'avatars',
uploadingToastTxt: 'Uploading avatar...'
);
Requirements #
- Firebase Core & Firebase Storage setup
- Add
app_toast
andtranslator
dependencies - Internet permission (mobile)
Dependencies #
- firebase_storage
- app_toast
- translator (custom)
License #
This README.md
provides installation instructions, basic usage examples, error handling, and additional features. Make sure to replace the version placeholder with the actual version number when you publish it on pub.dev
.
Made with by Shohidul Islam / GenieCoder