marchdev-tk / file_selector

File selection on both Mobile (Android/iOS), Web and Desktop (Windows, macOS, Linux).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

file_selector

Build GitHub GitHub stars

THIS PLUGIN IS DISCONTINUED

Getting Started

In order to use this plugin, add dependency in the pubspec.yaml:

file_selector:
    git:
      url: https://github.com/marchdev-tk/file_selector

Add an import to dart file:

import 'package:file_selector/file_selector.dart';

Samples

Web sample:

Web Sample

Desktop sample:

Desktop Sample

Mobile sample:

Mobile Sample

To pick single file use:

final File file = await FileSelector().pickFile(
    type: FileType.img,
    confirmButtonText: 'Select',
);

where:

  • confirmButtonText (works only on Desktop) if set, changes default confirmation text on file picker popup;

  • type represents the group of required types of specific type, could be one of the following:

    • any or */*
    • img or image/*
      • png or image/png
      • jpg or image/jpeg
      • gif or image/gif
      • bmp or image/bmp
    • pdf or application/pdf

To pick multiple file use:

final List<File> files = await FileSelector().pickFiles(
    types: [FileType.png, FileType.bmp],
    confirmButtonText: 'Select',
);

The only difference of pickFiles method from pickFile is that multiple files could be selected same as multiple types.

Return type File contains folowing fields:

  • name of the file
  • path to the file, for Web it is empty
  • bytes array of bytes

Feature requests and Bug reports

Feel free to post a feature requests or report a bug here.

About

File selection on both Mobile (Android/iOS), Web and Desktop (Windows, macOS, Linux).

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Dart 48.7%Language:C++ 33.0%Language:Batchfile 6.1%Language:C 5.0%Language:Ruby 3.2%Language:HTML 2.7%Language:Swift 0.9%Language:Kotlin 0.3%Language:Objective-C 0.1%