Skip to content

The 'variance' language feature is disabled for this library. for Dart 3.5.4 on Flutter Web #57112

@tolotrasamuel

Description

@tolotrasamuel

flutter build web --web-renderer html --csp --enable-experiment=variance

In the previous version I tested, 3.4.3 this command above works fine.
3.22.2 │ stable │ 3.22.2 │ 3.4.3 │ Jun 6, 2024 │ │ ● │

I upgraded to 3.5.4 and I got the following errors:

3.24.5 │ stable │ 3.24.5 │ 3.5.4 │ Nov 14, 2024 │ │


../shared_views/lib/views/forms/generic_form/dropdown_field.dart
:39:1:
Error: The 'variance' language feature is disabled for this
library.
inout T, inout
^^^^^
../shared_views/lib/views/radio/radio_builder.dart:3:27:
Error: The 'variance' language feature is disabled for this
library.
class OptionsBuilderParam<inout T> {
                          ^^^^^
../../.pub-cache/hosted/pub.dev/archive-3.4.10/lib/src/bzip2/bzi
p2.dart:5:7:
Error: Method not found: 'UnmodifiableUint8ListView'.
      UnmodifiableUint8ListView(Uint8List(0));
      ^^^^^^^^^^^^^^^^^^^^^^^^^
../../.pub-cache/hosted/pub.dev/archive-3.4.10/lib/src/bzip2/bzi
p2.dart:7:7:
Error: Method not found: 'UnmodifiableUint32ListView'.
      UnmodifiableUint32ListView(Uint32List(0));
      ^^^^^^^^^^^^^^^^^^^^^^^^^^
../../.pub-cache/hosted/pub.dev/archive-3.4.10/lib/src/bzip2/bzi
p2.dart:9:7:
Error: Method not found: 'UnmodifiableInt32ListView'.
      UnmodifiableInt32ListView(Int32List(0));
      ^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Compilation failed.
  Command:
  /Users/me/fvm/versions/3.24.5/bin/cache/dart-sdk/bin/dart
  --disable-dart-dev
  /Users/me/fvm/versions/3.24.5/bin/cache/dart-sdk/bin/snaps
  hots/dart2js.dart.snapshot
  --platform-binaries=/Users/me/fvm/versions/3.24.5/bin/cach
  e/flutter_web_sdk/kernel --invoker=flutter_tool
  --enable-experiment=variance -Ddart.vm.product=true
  -DFLUTTER_WEB_AUTO_DETECT=false -DFLUTTER_WEB_USE_SKIA=false
  -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-ca
  nvaskit/a18df97ca57a249df5d8d68cd0820600223ce262/
  --native-null-assertions --no-source-maps -o
  /Users/me/StudioProjects/project/.dart_tool/flutter_bu
  ild/091ff8fe595dc038c06c28bb4d39e856/app.dill
  --packages=.dart_tool/package_config.json --cfe-only
  /Users/me/StudioProjects/project/.dart_tool/flutter_bu
  ild/091ff8fe595dc038c06c28bb4d39e856/main.dart
#0      RunResult.throwException (package:flutter_tools/src/base/process.dart:122:5)
#1      _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:370:19)
<asynchronous suspension>
#2      Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:203:5)
<asynchronous suspension>
#3      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:875:9)
<asynchronous suspension>
#4      Future.wait.<anonymous closure> (dart:async/future.dart:534:21)
<asynchronous suspension>
#5      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32)
<asynchronous suspension>
#6      Future.wait.<anonymous closure> (dart:async/future.dart:534:21)
<asynchronous suspension>
#7      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32)
<asynchronous suspension>
#8      FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:635:16)
<asynchronous suspension>
#9      WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:92:34)
<asynchronous suspension>
#10     BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:230:5)
<asynchronous suspension>
#11     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1408:27)
<asynchronous suspension>
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#13     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#14     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:420:9)
<asynchronous suspension>
#15     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#16     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:5)
<asynchronous suspension>
#17     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:130:9)
<asynchronous suspension>
#18     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#19     main (package:flutter_tools/executable.dart:93:3)
<asynchronous suspension>

Compiling lib/main.dart for the Web...                             40.4s
Error: Failed to compile application for the Web.

It is worth nothing that this does not occur on Android and iOS build, but I faced it on Web.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.needs-infoWe need additional information from the issue author (auto-closed after 14 days if no response)type-questionA question about expected behavior or functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions