file_picker_web 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new72

file_picker_web #

The web implementation of file_picker.

Usage #

Import the package #

To use this plugin in your Flutter Web app, simply add it as a dependency in your pubspec alongside the base file_picker plugin.

(This is only temporary: in the future we hope to make this package an "endorsed" implementation of file_picker, so that it is automatically included in your Flutter Web app when you depend on package:file_picker.)

This is what the above means to your pubspec.yaml:

...
dependencies:
  ...
  file_picker: ^1.9.0
  file_picker_web: ^0.0.1
  ...

Use the plugin #

Once you have the file_picker_web dependency in your pubspec, you should be able to use package:file_picker as normal.

1.0.0 #

Adds public API documentation and updates file_picker_platform_interface dependency.

0.0.2 #

Added no-op iOS podspec to prevent build issues on iOS.

0.0.1 #

Creation of File Picker Web project draft (not yet usable)

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.getFile() ?? [];
    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'),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  file_picker_web: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:file_picker_web/file_picker_web.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
59
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
62
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

We analyzed this package on May 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.1
  • pana: 0.13.8-dev
  • Flutter: 1.17.0

Health suggestions

Format lib/file_picker_web.dart.

Run flutter format to format lib/file_picker_web.dart.

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/miguelpruivo/plugins_flutter_file_picker/file_picker_web was unreachable.

The package description is too short. (-18 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
file_picker_platform_interface ^1.0.0 1.0.0
flutter 0.0.0
flutter_web_plugins 0.0.0
Transitive dependencies
collection 1.14.12
meta 1.1.8
plugin_platform_interface 1.0.2
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test