Skip to content

Flutter Web failing to compile with "Undetermined Nullability" #82838

Description

@matthewtsmith

I have a project that uses a null safe library called hasura_connect, version 3.0.2.

When this project is added to the pubspec.yaml and imported into the code flutter web fails to compile in debug mode ( release mode is successful ).

I've attached a sample project that reproduces the issue. I also forked the hasura_connect repository to look for code issues but there is nothing obvious. It appears to be a bug in the dart dev compiler.

The output from the compiler is the following when using flutter run -d chrome --verbose

logs
[+2852 ms] Unhandled exception:
[   +1 ms] Unsupported operation: Undetermined Nullability
[        ] #0      ProgramCompiler._emitFutureOrType (package:dev_compiler/src/kernel/compiler.dart:2872:7)
[        ] #1      ProgramCompiler._normalizeFutureOr (package:dev_compiler/src/kernel/compiler.dart:2741:12)
[        ] #2      ProgramCompiler.visitFutureOrType (package:dev_compiler/src/kernel/compiler.dart:2754:7)
[        ] #3      FutureOrType.accept (package:kernel/ast.dart:11126:42)
[        ] #4      ProgramCompiler._emitType (package:dev_compiler/src/kernel/compiler.dart:2670:54)
[        ] #5      ProgramCompiler.visitFunctionType (package:dev_compiler/src/kernel/compiler.dart:2951:22)
[        ] #6      ProgramCompiler._emitFunctionTagged (package:dev_compiler/src/kernel/compiler.dart:2626:19)
[        ] #7      ProgramCompiler.visitFunctionExpression (package:dev_compiler/src/kernel/compiler.dart:5947:12)
[        ] #8      FunctionExpression.accept (package:kernel/ast.dart:8099:44)
[        ] #9      ProgramCompiler._visitExpression (package:dev_compiler/src/kernel/compiler.dart:3681:20)
[        ] #10     ProgramCompiler._emitArgumentList (package:dev_compiler/src/kernel/compiler.dart:5389:11)
[   +6 ms] #11     ProgramCompiler._emitMethodCall (package:dev_compiler/src/kernel/compiler.dart:4697:16)
[        ] #12     ProgramCompiler.visitInstanceInvocation (package:dev_compiler/src/kernel/compiler.dart:4617:12)
[        ] #13     InstanceInvocation.accept (package:kernel/ast.dart:5178:44)
[        ] #14     ProgramCompiler._visitExpression (package:dev_compiler/src/kernel/compiler.dart:3681:20)
[        ] #15     ProgramCompiler.visitReturnStatement (package:dev_compiler/src/kernel/compiler.dart:4211:38)
[        ] #16     ReturnStatement.accept (package:kernel/ast.dart:9497:43)
[        ] #17     ProgramCompiler._visitStatement (package:dev_compiler/src/kernel/compiler.dart:3587:20)
[        ] #18     MappedListIterable.elementAt (dart:_internal/iterable.dart:412:31)
[        ] #19     ListIterator.moveNext (dart:_internal/iterable.dart:341:26)
[   +5 ms] #20     new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:188:27)
[        ] #21     new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
[        ] #22     new List.of (dart:core-patch/array_patch.dart:50:28)
[        ] #23     ListIterable.toList (dart:_internal/iterable.dart:212:44)
[        ] #24     ProgramCompiler.visitBlock (package:dev_compiler/src/kernel/compiler.dart:3775:62)
[        ] #25     Block.accept (package:kernel/ast.dart:8518:43)
[        ] #26     ProgramCompiler._visitStatement (package:dev_compiler/src/kernel/compiler.dart:3587:20)
[        ] #27     ProgramCompiler._emitFunctionScopedBody (package:dev_compiler/src/kernel/compiler.dart:3620:18)
[        ] #28     ProgramCompiler._emitSyncFunctionBody.<anonymous closure> (package:dev_compiler/src/kernel/compiler.dart:3391:17)
[   +5 ms] #29     ProgramCompiler._withLetScope (package:dev_compiler/src/kernel/compiler.dart:2244:25)
[        ] #30     ProgramCompiler._withCurrentFunction (package:dev_compiler/src/kernel/compiler.dart:3425:18)
[        ] #31     ProgramCompiler._emitSyncFunctionBody (package:dev_compiler/src/kernel/compiler.dart:3387:17)
[        ] #32     ProgramCompiler._emitFunction (package:dev_compiler/src/kernel/compiler.dart:3204:11)
[        ] #33     ProgramCompiler._emitLibraryFunction (package:dev_compiler/src/kernel/compiler.dart:2606:14)
[        ] #34     MappedIterator.moveNext (dart:_internal/iterable.dart:390:20)
[        ] #35     new _GrowableList._ofOther (dart:core-patch/growable_array.dart:198:26)
[        ] #36     new _GrowableList.of (dart:core-patch/growable_array.dart:152:26)
[   +5 ms] #37     new List.of (dart:core-patch/array_patch.dart:50:28)
[        ] #38     Iterable.toList (dart:core/iterable.dart:366:12)
[        ] #39     ProgramCompiler._emitLibraryProcedures (package:dev_compiler/src/kernel/compiler.dart:2572:10)
[        ] #40     ProgramCompiler._emitLibrary (package:dev_compiler/src/kernel/compiler.dart:539:7)
[        ] #41     List.forEach (dart:core-patch/growable_array.dart:403:8)
[        ] #42     ProgramCompiler.emitModule (package:dev_compiler/src/kernel/compiler.dart:398:15)
[        ] #43     JavaScriptBundler.compile (package:frontend_server/src/javascript_bundle.dart:146:33)
[        ] <asynchronous suspension>
[        ] #44     FrontendCompiler.writeJavascriptBundle (package:frontend_server/frontend_server.dart:638:32)
[        ] <asynchronous suspension>
[   +7 ms] #45     FrontendCompiler.compile (package:frontend_server/frontend_server.dart:549:9)
[        ] <asynchronous suspension>
[        ] #46     listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1119:11)
[        ] <asynchronous suspension>
[  +47 ms] "flutter run" took 11,569ms.
[   +6 ms] the Dart compiler exited unexpectedly.
[        ] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      DefaultResidentCompiler._compile.<anonymous closure> (package:flutter_tools/src/compile.dart:734:13)
           #2      _rootRun (dart:async/zone.dart:1346:47)
           #3      _CustomZone.run (dart:async/zone.dart:1258:19)
           #4      _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
           #5      _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:394:13)
           #6      _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:404:15)
           #7      _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
           #8      _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:87:11)
           #9      _EventSinkWrapper.close (dart:async/stream_transformers.dart:21:11)
           #10     _StringAdapterSink.close (dart:convert/string_conversion.dart:251:11)
           #11     _LineSplitterSink.close (dart:convert/line_splitter.dart:139:11)
           #12     _SinkTransformerStreamSubscription._handleDone (dart:async/stream_transformers.dart:132:24)
           #13     _rootRun (dart:async/zone.dart:1346:47)
           #14     _CustomZone.run (dart:async/zone.dart:1258:19)
           #15     _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
           #16     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:394:13)
           #17     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:404:15)
           #18     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
           #19     _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:87:11)
           #20     _EventSinkWrapper.close (dart:async/stream_transformers.dart:21:11)
           #21     _StringAdapterSink.close (dart:convert/string_conversion.dart:251:11)
           #22     _Utf8ConversionSink.close (dart:convert/string_conversion.dart:305:20)
           #23     _ConverterStreamEventSink.close (dart:convert/chunked_conversion.dart:81:18)
           #24     _SinkTransformerStreamSubscription._handleDone (dart:async/stream_transformers.dart:132:24)
           #25     _rootRun (dart:async/zone.dart:1346:47)
           #26     _CustomZone.run (dart:async/zone.dart:1258:19)
           #27     _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
           #28     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:394:13)
           #29     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:404:15)
           #30     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
           #31     _SyncStreamControllerDispatch._sendDone (dart:async/stream_controller.dart:741:19)
           #32     _StreamController._closeUnchecked (dart:async/stream_controller.dart:596:7)
           #33     _StreamController.close (dart:async/stream_controller.dart:589:5)
           #34     _Socket._onData (dart:io-patch/socket_patch.dart:2167:21)
           #35     _rootRunUnary (dart:async/zone.dart:1370:13)
           #36     _CustomZone.runUnary (dart:async/zone.dart:1265:19)
           #37     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
           #38     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
           #39     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
           #40     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
           #41     _StreamController._add (dart:async/stream_controller.dart:607:7)
           #42     _StreamController.add (dart:async/stream_controller.dart:554:5)
           #43     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1703:35)
           #44     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1201:18)
           #45     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
           #46     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
           #47     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:120:13)
           #48     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:185:5)

Flutter doctor output:

flutter doctor -v
[✓] Flutter (Channel beta, 2.2.0-10.3.pre, on macOS 11.1 20C69 darwin-x64, locale en-US)
    • Flutter version 2.2.0-10.3.pre at /Users/matthew/Library/Flutter
    • Framework revision 06e2fd6357 (10 days ago), 2021-05-08 11:28:22 -0700
    • Engine revision a123e75c60
    • Dart version 2.13.0 (build 2.13.0-211.14.beta)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/matthew/Library/Android/sdk
    • Platform android-30, build-tools 29.0.3
    • Java binary at: /Users/matthew/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.6953283/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Users/matthew/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.6953283/Android
      Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.1.1)
    • IntelliJ at /Users/matthew/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 56.0.5
    • Dart plugin version 211.7233

[✓] VS Code (version 1.56.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.22.0

[✓] Connected device (3 available)
    • iPhone 11 Pro Max (mobile) • C7341265-8770-4FE4-9575-27F88790E7CA • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-4
      (simulator)
    • macOS (desktop)            • macos                                • darwin-x64     • macOS 11.1 20C69 darwin-x64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 90.0.4430.212
    ! Error: iPhone - Matt is not connected. Xcode will continue when iPhone - Matt is connected. (code -13)

• No issues found!

flutter_web_compile_sample.zip

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: null-safetySupport for Dart's null safety featuredependency: dartDart team may need to help usfound in release: 2.2Found to occur in 2.2found in release: 2.3Found to occur in 2.3has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallytoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions