filesaverz 1.1.0 copy "filesaverz: ^1.1.0" to clipboard
filesaverz: ^1.1.0 copied to clipboard

outdated

A package that makes it easy for user to browse folder and save file in android.

File Saver Z #



A package that makes it easy for user to browse folder and save file.

Preview #

Usage #

First, add permission in you AndroidManifest.xml.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.example">
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>


And then import the filesaver (with z) package.

import 'package:filesaverz/filesaver.dart';


And set fileSaver widget like this.

FileSaver fileSaver = FileSaver(
  initialFileName: 'New File',
  fileTypes: const ['.txt','.pdf'],
);


Now in async function, call this to getPath.

String? path = await fileSaver.getPath(context);


Use this to call File(path).writeAsBytes(bytes) function.

fileSaver.writeAsBytes(bytes, context: context);


Use this to call File(path).writeAsBytesSync(bytes) function.

fileSaver.writeAsBytesSync(bytes, context: context);


Use this to call File(path).writeAsString(contents) function.

fileSaver.writeAsString(contents, context: context);


Use this to call File(path).writeAsStringSync(contents) function.

fileSaver.writeAsStringSync(contents, context: context);

Documentation #

  • Widget? headerBuilder :
    Is an optional header widget. Default widget only shows title and close button.

    headerBuilder: (context, state) => Widget(),
    
  • Widget? bodyBuilder :
    Is an optional widget as well. By Default displaying list of FileSystemEntity.

    bodyBuilder: (context, state) => Widget(),
    
  • Widget? footerBuilder :
    Is also an optional widget. It's displaying option to input new file name and select file types.

    footerBuilder: (context, state) => Widget(),
    
  • FileSaverStyle? style :
    A custom style in FileSaver. It contains colors and textstyles.

    style: FileSaverStyle(primaryColor: Colors.orange);
    
  • String initialFileName :
    Is a file name. If user enters new name, this will be replaced.

    initialFileName: 'New File';
    
  • Director? initialDirectory :
    Is an optional directory. If initialDirectory is null, in android it will call a method channel of Environment.getExternalStorageDirectory().

  • List<String> fileTypes :
    Displaying list of file extensions.

    fileTypes: const ['.txt','.pdf','.rtf'];
    

Example #

17
likes
0
pub points
54%
popularity

Publisher

verified publisherinidia.app

A package that makes it easy for user to browse folder and save file in android.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, permission_handler, provider

More

Packages that depend on filesaverz