file_picker_web 2.0.0 copy "file_picker_web: ^2.0.0" to clipboard
file_picker_web: ^2.0.0 copied to clipboard

discontinued

Web platform implementation of file_picker. Provides a way to pick files with filter support for Web.

example/lib/main.dart

// ignore: avoid_web_libraries_in_flutter
import 'dart:html';
import 'package:file_picker_web/file_picker_web.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

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

class _MyAppState extends State<MyApp> {
  List<File> _files = [];

  void _pickFiles() async {
    _files = await FilePicker.getMultiFile() ?? [];
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: <Widget>[
              Expanded(
                child: _files.isNotEmpty
                    ? ListView.separated(
                        itemBuilder: (BuildContext context, int index) =>
                            Text(_files[index].name),
                        itemCount: _files.length,
                        separatorBuilder: (_, __) => const Divider(
                          thickness: 5.0,
                        ),
                      )
                    : Center(
                        child: Text(
                          'Pick some files',
                          textAlign: TextAlign.center,
                        ),
                      ),
              ),
              Padding(
                padding: const EdgeInsets.all(15.0),
                child: RaisedButton(
                  onPressed: _pickFiles,
                  child: Text('Pick Files'),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}
9
likes
30
pub points
63%
popularity

Publisher

verified publishermiguelruivo.com

Web platform implementation of file_picker. Provides a way to pick files with filter support for Web.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

file_picker_platform_interface, flutter, flutter_web_plugins

More

Packages that depend on file_picker_web