document_chooser 0.0.1 copy "document_chooser: ^0.0.1" to clipboard
document_chooser: ^0.0.1 copied to clipboard

outdatedDart 1 only

A Flutter chooser to allow users to pick documnet files avaialble on ther device

document chooser plugin for flutter #

A Flutter chooser to allow users to pick documenet files avaialble on their device. iOS implentation is based off this plugin;

Note: only chooseDocument is working chooseDocuments is currently broken on both platforms

Installation #

First add document_chooser as a dependency in your pubspec.yaml file.

Permsionss #

No configuration required - the plugin should work out of the box.

Example #

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

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {

  List<String> _documents = [];

  @override
  void initState() {
    super.initState();
  }


  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app'),
        ),
        body: new Column(
          children: [
            getButton("Pick document", ()=>pickDocument()),
            getButton("Pick documents", ()=>pickDocuments()),
            Expanded(
              child: ListView(children: getDocuments(),),
            )
          ],
        ),
      ),
    );
  }

  Widget getButton(String text, Function action){
    return RaisedButton(
      onPressed: action,
      child: Text(text),
    );
  }

  pickDocument() async {
    String path = await DocumentChooser.chooseDocument();
    setState(()=>_documents = [path]);
  }

  pickDocuments() async {
    List<String> paths = await DocumentChooser.chooseDocuments();
    setState(()=>_documents = paths);
  }

  getDocuments() {
    return List.generate(_documents.length, (i) => Text(_documents[i]));
  }

}
0
likes
0
pub points
50%
popularity

Publisher

unverified uploader

A Flutter chooser to allow users to pick documnet files avaialble on ther device

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on document_chooser