documents_picker 1.0.0 documents_picker: ^1.0.0 copied to clipboard
Simple way to get documents from local storage or ICloud(For IOS).
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:documents_picker/documents_picker.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
List<String> docPaths;
void _getDocuments() async {
docPaths = await DocumentsPicker.pickDocuments;
if (!mounted) return;
setState(() {});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Plugin example app'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
FlatButton(
child: Text('Get documents'),
onPressed: _getDocuments,
),
if (docPaths != null)
Text(docPaths.join('\n'))
],
),
),
),
);
}
}