flutter_installer 0.1.3 copy "flutter_installer: ^0.1.3" to clipboard
flutter_installer: ^0.1.3 copied to clipboard

A plugin that allow install files in android, ios, linux, windows and macos.

Flutter Installer #

Flutter Installer is a Flutter package designed to assist with file operations within your application's documents directory. It provides an easy-to-use API for installing, deleting, checking, reading, copying, and renaming files.

Features: #

  • Install file from a list of bytes
  • Install file from application assets
  • Delete specific file
  • Delete all files in the directory
  • Check if a file exists
  • Read file content
  • Copy a file
  • Rename a file

Installation #

To use this package, add flutter_installer as a dependency in your pubspec.yaml file.

Usage #

First, import the package:

import 'package:flutter_installer/flutter_installer.dart';

Then, create an instance of the FlutterInstaller class:

FlutterInstaller installer = FlutterInstaller();

You can specify a directory name while creating the FlutterInstaller object. If not specified, it defaults to 'flutter_installer':

FlutterInstaller installer = FlutterInstaller(mainDirectory: 'my_directory');

Methods #

Here are some examples of using the FlutterInstaller methods:

install #

Install a file from a list of bytes:

String filePath = await installer.install(
  fileBytes: myFileBytes,
  name: 'myfile.txt',
  replace: true
);

installFromAssets #

Install a file from application assets:

String filePath = await installer.installFromAssets(
  assetPath: 'assets/myfile.txt',
  name: 'myfile.txt',
  replace: true
);

deleteFile #

Delete a specific file:

bool isDeleted = await installer.deleteFile('myfile.txt');

deleteAllFiles #

Delete all files in the directory:

await installer.deleteAllFiles();

isFileExists #

Check if a file exists:

bool exists = await installer.isFileExists('myfile.txt');

readFile #

Read a file:

List<int> fileContent = await installer.readFile('myfile.txt');

copyFile #

Copy a file:

String newFilePath = await installer.copyFile(
  existingFileName: 'myfile.txt',
  newFileName: 'copied_myfile.txt'
);

renameFile #

Rename a file:

String newFilePath = await installer.renameFile(
  existingFileName: 'myfile.txt',
  newFileName: 'renamed_myfile.txt'
);

Exception Handling #

All methods throw a FlutterInstallerException in case of any errors during execution. It's recommended to use try-catch blocks to handle these exceptions.

Contributions #

If you encounter any problem or the library is missing a feature feel free to open an issue. Feel free to fork, improve the package and make pull request.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

0
likes
110
pub points
36%
popularity

Publisher

unverified uploader

A plugin that allow install files in android, ios, linux, windows and macos.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, path_provider, plugin_platform_interface

More

Packages that depend on flutter_installer