Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.
/ file_selector Public archive

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

License

Notifications You must be signed in to change notification settings

marchdev-tk/file_selector

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.