image_picker_for_web 0.1.0+1

  • Readme
  • Changelog
  • Installing
  • 85

image_picker_for_web #

A web implementation of image_picker.

Browser Support #

Since Web Browsers don't offer direct access to their users' file system, this plugin provides a PickedFile abstraction to make access access uniform across platforms.

The web version of the plugin puts network-accessible URIs as the path in the returned PickedFile.

URL.createObjectURL() #

The PickedFile object in web is backed by URL.createObjectUrl Web API, which is reasonably well supported across all browsers:

Data on support for the bloburls feature across the major browsers from

However, the returned path attribute of the PickedFile points to a network resource, and not a local path in your users' drive. See Use the plugin below for some examples on how to use this return value in a cross-platform way.

input file "accept" #

In order to filter only video/image content, some browsers offer an accept attribute in their input type="file" form elements:

Data on support for the input-file-accept feature across the major browsers from

This feature is just a convenience for users, not validation.

Users can override this setting on their browsers. You must validate in your app (or server) that the user has picked the file type that you can handle.

input file "capture" #

In order to "take a photo", some mobile browsers offer a capture attribute:

Data on support for the html-media-capture feature across the major browsers from

Each browser may implement capture any way they please, so it may (or may not) make a difference in your users' experience.

Usage #

Import the package #

This package is an unendorsed web platform implementation of image_picker.

In order to use this, you'll need to depend in image_picker: ^0.6.7 (which was the first version of the plugin that allowed federation), and image_picker_for_web: ^0.1.0.

  image_picker: ^0.6.7
  image_picker_for_web: ^0.1.0

Use the plugin #

You should be able to use package:image_picker almost as normal.

Once the user has picked a file, the returned PickedFile instance will contain a network-accessible URL (pointing to a location within the browser).

The instace will also let you retrieve the bytes of the selected file across all platforms.

If you want to use the path directly, your code would need look like this:

if (kIsWeb) {;
} else {

Or, using bytes:

Image.memory(await pickedFile.readAsBytes())

0.1.0+1 #

  • Remove android directory.

0.1.0 #

  • Initial open-source release.

Use this package as a library

1. Depend on it

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

  image_picker_for_web: ^0.1.0+1

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:image_picker_for_web/image_picker_for_web.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform android

Because of import path [package:image_picker_for_web/image_picker_for_web.dart] that declares support for platforms: web

Package does not support Flutter platform ios

Because of import path [package:image_picker_for_web/image_picker_for_web.dart] that declares support for platforms: web

Package does not support Flutter platform linux

Because of import path [package:image_picker_for_web/image_picker_for_web.dart] that declares support for platforms: web

Package does not support Flutter platform macos

Because of import path [package:image_picker_for_web/image_picker_for_web.dart] that declares support for platforms: web

Package does not support Flutter platform windows

Because of import path [package:image_picker_for_web/image_picker_for_web.dart] that declares support for platforms: web

Package not compatible with SDK dart

because of import path [image_picker_for_web] that is in a package requiring null.

Package not compatible with SDK flutter

Because it is not compatible with any of the supported runtimes: flutter-native, flutter-web

Package not compatible with runtime flutter-web on web

Because of the import of dart:io via the import chain package:image_picker_for_web/image_picker_for_web.dartpackage:image_picker_platform_interface/image_picker_platform_interface.dartpackage:image_picker_platform_interface/src/types/types.dartpackage:image_picker_platform_interface/src/types/lost_data_response.dartdart:io

Health suggestions

Fix lib/image_picker_for_web.dart. (-0.50 points)

Analysis of lib/image_picker_for_web.dart reported 1 hint:

line 126 col 39: Avoid using braces in interpolation when not needed.

Maintenance issues and suggestions

No valid SDK. (-20 points)

The analysis could not detect a valid SDK that can use this package.

The package description is too short. (-17 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.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and image_picker_for_web.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
flutter 0.0.0
flutter_web_plugins 0.0.0
image_picker_platform_interface ^1.1.0 1.1.0
js ^0.6.0 0.6.2
meta ^1.1.7 1.1.8
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
http 0.12.1
http_parser 3.1.4
path 1.7.0
plugin_platform_interface 1.0.2
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
pedantic ^1.8.0 1.9.0 1.9.1