plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

[Bug][Web]: Cannot build web when package_info_plus is in pubspec.yaml

Open happyelectronics opened this issue 1 year ago • 3 comments

Platform

Web

Plugin

package_info_plus

Version

1.4.3

Flutter SDK

3.0.5

Steps to reproduce

  1. Add package_info_plus: ^1.4.3 to dependencies in pubspec.yaml
  2. flutter build web

Code Sample

name: testpip
description: A new Flutter project.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: ">=2.17.6 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  package_info_plus: ^1.4.3
  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0

flutter:

  uses-material-design: true

Logs

Building with sound null safety 💪

Target dart2js failed: Exception: Warning: The 'dart2js' entrypoint script is deprecated, please use 'dart compile js' instead.
/opt/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/browser_client.dart:31:18:
Error: 'HttpRequest' isn't a type.
  final _xhrs = <HttpRequest>{};
                 ^^^^^^^^^^^
/opt/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/browser_client.dart:43:15:
Error: The method 'HttpRequest' isn't defined for the class 'BrowserClient'.
 - 'BrowserClient' is from 'package:http/src/browser_client.dart' ('/opt/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/browser_client.dart').
    var xhr = HttpRequest();
              ^^^^^^^^^^^
Error: Compilation failed.


Compiling lib/main.dart for the Web...                             12.9s
Exception: Failed to compile application for the Web.

Flutter Doctor

[✓] Flutter (Channel stable, 3.0.5, on Ubuntu 20.04.4 LTS 5.4.0-122-generic, locale en_GB.UTF-8)
    • Flutter version 3.0.5 at /opt/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (2 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /media/kolmanp/Data/opt/android-sdk-linux
    • Platform android-32, build-tools 32.1.0-rc1
    • ANDROID_HOME = /media/kolmanp/Data/opt/android-sdk-linux
    • Java binary at: /opt/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /snap/bin/chromium

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[✓] Android Studio (version 2021.2)
    • Android Studio at /opt/android-studio
    • Flutter plugin version 67.1.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.69.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.42.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 20.04.4 LTS 5.4.0-122-generic
    • Chrome (web)    • chrome • web-javascript • Chromium 103.0.5060.134 snap

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

happyelectronics avatar Jul 29 '22 09:07 happyelectronics

mhh the example inside package_info_plus/examples runs on Chrome for me.

How are you building for web, which command do you use?

miquelbeltran avatar Jul 31 '22 13:07 miquelbeltran

I tried the command flutter build web or click to start in Android Studio Chipmunk | 2021.2.1.

happyelectronics avatar Jul 31 '22 14:07 happyelectronics

yep, no problems for me:

$ flutter build web 

💪 Building with sound null safety 💪

Compiling lib/main.dart for the Web...                             12.3s

Can you check if you have the same error with the example project?

miquelbeltran avatar Jul 31 '22 16:07 miquelbeltran

Closing due to inactivity

vbuberen avatar Dec 10 '22 22:12 vbuberen