flutter_easy_tools 1.0.0
flutter_easy_tools: ^1.0.0 copied to clipboard
A Flutter package that simplifies common tasks like permission handling and file operations with a clean, unified API.
Flutter Easy Tools #
A comprehensive Flutter package that simplifies common tasks like permission handling and file operations with a clean, unified API.
Features #
- Unified Permission Management: Handle all app permissions through a single, easy-to-use API
- Cross-Platform File Operations: Work with files consistently across iOS and Android
- File Downloads: Download files with progress tracking
- Storage Management: Save, check, and delete files with ease
- No External Dependencies: Lightweight implementation using only Flutter core libraries
- Type-Safe APIs: Compile-time safety with enums and strong typing
Getting Started #
Add Dependency #
Add this to your package's pubspec.yaml file:
dependencies:
flutter_easy_tools: ^1.0.0 # Use the latest version
Android Configuration #
Add the following permissions to your AndroidManifest.xml if needed:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- Add other permissions as needed -->
iOS Configuration #
Add the following to your Info.plist for iOS permissions:
<key>NSCameraUsageDescription</key>
<string>Camera access is required for this feature</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo library access is required to save images</string>
<!-- Add other usage descriptions as needed -->
Usage #
Permission Management #
import 'package:flutter_easy_tools/flutter_easy_tools.dart';
// Request multiple permissions
final permissions = await PermissionManager.request([
EasyPermission.camera,
EasyPermission.storage,
EasyPermission.location,
]);
// Check a single permission
final hasCameraPermission = await PermissionManager.check(EasyPermission.camera);
File Operations #
import 'package:flutter_easy_tools/flutter_easy_tools.dart';
// Get application documents directory
final dir = await NativeFileHandler.getApplicationDocumentsDirectory();
// Download a file
final filePath = await NativeFileHandler.downloadFile(
url: 'https://example.com/file.pdf',
fileName: 'document.pdf',
directory: dir,
onProgress: (progress) {
print('Download progress: $progress%');
},
);
// Save bytes to a file
final success = await NativeFileHandler.saveFile(
bytes: myBytes,
fileName: 'data.bin',
directory: dir,
);
// Check if file exists
final exists = await NativeFileHandler.fileExists('$dir/document.pdf');
// Delete a file
await NativeFileHandler.deleteFile('$dir/document.pdf');
Additional Information #
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
Reporting Issues #
If you encounter any issues or have feature requests, please file them in the issue tracker.
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Maintainers #
Version #
1.0.0