Skip to content

Compiler error in Android/iOS(DartVM) #10

@abc873693

Description

@abc873693

I want to use both image_picker and image_picker_web.
It work in flutter web.
But native platform error.

Compiler message:
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_web-1.0.8/lib/image_picker_web.dart:6:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
       ^

../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_web-1.0.8/lib/src/web_image_picker.dart:2:8: Error: Not found: 'dart:html'

import 'dart:html' as html;

       ^

../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart:6:8: Error: Not found: 'dart:html'

import 'dart:html';

       ^

../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_web-1.0.8/lib/image_picker_web.dart:32:10: Error: Type 'html.File' not found.

  Future<html.File> _pickFile(String type) async {

         ^^^^^^^^^

../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart:34:18: Error: 'HttpRequest' isn't a type.

  final _xhrs = <HttpRequest>{};

                 ^^^^^^^^^^^
Running pod install...                                              2.8s
Building macOS application...
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_web-1.0.8/lib/image_picker_web.dart:33:16: Error: 'FileUploadInputElement' isn't a type.
    final html.FileUploadInputElement input = html.FileUploadInputElement();
               ^^^^^^^^^^^^^^^^^^^^^^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_web-1.0.8/lib/image_picker_web.dart:33:47: Error: Method not found: 'FileUploadInputElement'.
    final html.FileUploadInputElement input = html.FileUploadInputElement();
                                              ^^^^^^^^^^^^^^^^^^^^^^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_web-1.0.8/lib/src/web_image_picker.dart:7:16: Error: 'FileUploadInputElement' isn't a type.
    final html.FileUploadInputElement input = html.FileUploadInputElement();
               ^^^^^^^^^^^^^^^^^^^^^^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_web-1.0.8/lib/src/web_image_picker.dart:7:47: Error: Method not found: 'FileUploadInputElement'.
    final html.FileUploadInputElement input = html.FileUploadInputElement();
                                              ^^^^^^^^^^^^^^^^^^^^^^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_web-1.0.8/lib/src/web_image_picker.dart:12:20: Error: Method not found: 'FileReader'.
    final reader = html.FileReader();
                   ^^^^^^^^^^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_web-1.0.8/lib/src/web_image_picker.dart:28:16: Error: 'FileUploadInputElement' isn't a type.
    final html.FileUploadInputElement input = html.FileUploadInputElement();
               ^^^^^^^^^^^^^^^^^^^^^^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_web-1.0.8/lib/src/web_image_picker.dart:28:47: Error: Method not found: 'FileUploadInputElement'.
    final html.FileUploadInputElement input = html.FileUploadInputElement();
                                              ^^^^^^^^^^^^^^^^^^^^^^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_web-1.0.8/lib/src/web_image_picker.dart:33:20: Error: Method not found: 'FileReader'.
    final reader = html.FileReader();
                   ^^^^^^^^^^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart:58:34: Error: 'Blob' isn't a type.
      var blob = xhr.response as Blob ?? Blob([]);
                                 ^^^^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart:46:15: Error: The method 'HttpRequest' isn't defined for the class 'BrowserClient'.
 - 'BrowserClient' is from 'package:http/src/browser_client.dart' ('../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart').
Try correcting the name to the name of an existing method, or defining a method named 'HttpRequest'.
    var xhr = HttpRequest();
              ^^^^^^^^^^^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart:58:42: Error: The method 'Blob' isn't defined for the class 'BrowserClient'.
 - 'BrowserClient' is from 'package:http/src/browser_client.dart' ('../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart').
Try correcting the name to the name of an existing method, or defining a method named 'Blob'.
      var blob = xhr.response as Blob ?? Blob([]);
                                         ^^^^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart:59:20: Error: The method 'FileReader' isn't defined for the class 'BrowserClient'.
 - 'BrowserClient' is from 'package:http/src/browser_client.dart' ('../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FileReader'.
      var reader = FileReader();
                   ^^^^^^^^^^
../../../development/flutter/packages/flutter_web_plugins/lib/src/plugin_registry.dart:29:5: Error: Method not found: 'webOnlySetPluginHandler'.
    ui.webOnlySetPluginHandler(_binaryMessenger.handlePlatformMessage);
    ^^^^^^^^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions