How to Pick files and Images for upload with flutter web

Using dart:html package directly in Flutter is not recommended.

Instead, use this package:

Example of how to use in Flutter Web:

class FileUploadButton extends StatelessWidget {
  Widget build(BuildContext context) {
    return RaisedButton(
      child: Text('UPLOAD FILE'),
      onPressed: () async {
        var picked = await FilePicker.platform.pickFiles();

        if (picked != null) {

Note that FilePickerResult.path is not supported in Flutter Web.

Leave a Comment