Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter_file_manager for managing files

a set of utilities, that help managing files & directories in android system.

you are in your way to create file manager app or a gallery app.

usage

to use this package, add these
dependency in your pubspec.yaml file.

dependencies:
  flutter:
    sdk: flutter
  path: 1.6.2
  path_provider: 0.5.0+1
  flutter_file_manager: ^0.1.1

and, add read / write permissions in your
android/app/src/main/androidmanifest.xml

<uses-permission android:name="android.permission.write_external_storage"/>
<uses-permission android:name="android.permission.read_external_storage"/>

don’t forget to grant storage permissions to your app, manually or by this plugin simple_permissions

// framework
import 'package:flutter/material.dart';

// packages
import 'package:flutter_file_manager/flutter_file_manager.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart' as p;

void main() => runapp(new myapp());

class myapp extends statelesswidget {
  @override
  widget build(buildcontext context) {
    return new materialapp(
      home: scaffold(
          appbar: appbar(
            title: text("flutter file manager demo"),
          ),
          body: futurebuilder(
            future: _files(), // a previously-obtained future<string> or null
            builder: (buildcontext context, asyncsnapshot snapshot) {
              switch (snapshot.connectionstate) {
                case connectionstate.none:
                  return text('press button to start.');
                case connectionstate.active:
                case connectionstate.waiting:
                  return text('awaiting result...');
                case connectionstate.done:
                  if (snapshot.haserror)
                    return text('error: ${snapshot.error}');
                  return snapshot.data != null
                      ? listview.builder(
                          itemcount: snapshot.data.length,
                          itembuilder: (context, index) => card(
                                  child: listtile(
                                title: text(snapshot.data[index].absolute.path),
                                subtitle: text(
                                    "extension: ${p.extension(snapshot.data[index].absolute.path).replacefirst('.', '')}"), // getting extension
                              )))
                      : center(
                          child: text("nothing!"),
                        );
              }
              return null; // unreachable
            },
          )),
    );
  }

  _files() async {
    var root = await getexternalstoragedirectory();
    var fm = filemanager(root: root);
    var files = await fm.filestree(excludedpaths: ["/storage/emulated/0/android"]);
    return files;
  }
}

example about managing files app

features

  • file details
  • search files or directories: supports regular expressions
  • recent created files: you can exclude a list of directories from the tree
  • directories only tree: you can exclude a list of directories from the tree
  • files only tree: you can exclude a list of directories from the tree
  • files list from specific point
  • delete files
  • delete directory
  • temp file
  • sorting file by: type, size, date, ..

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Top