Skip to content

Unexpected null value error appears when running multiView on Flutter Web #153198

@CKunhardt

Description

@CKunhardt

Steps to reproduce

Create new Flutter project on "stable" branch
Add flutter_bootstrap.js to web folder
Configure the engineInitializer to use multiViewEnabled: true
Run "flutter build web"
Run "flutter run -d chrome"

Expected results

Example code completes without error, allows Flutter app to be loaded in a

with a subsequent runApp() call.

Actual results

App experiences an uncaught exception when trying to call .runApp() and crashes

Code sample

Code sample
// flutter_bootstrap.js
{{flutter_js}}
{{flutter_build_config}}

_flutter.loader.load({
  onEntrypointLoaded: async function(engineInitializer) {
    const appRunner = await engineInitializer.initializeEngine({
      multiViewEnabled: true,
    });

    await appRunner.runApp();
  }
});

No changes to main.dart from initial project generation.

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

When running in the Chrome Debugger:
This app is linked to the debug service: ws://127.0.0.1:49590/JGZRNP2PoDM=/ws
dom.dart:178 Rejecting promise with error: Unexpected null value.
DomConsoleExtension$124warn @ dom.dart:178
(anonymous) @ dom.dart:178
(anonymous) @ js_promise.dart:29
runUnary @ zone.dart:1661
handleError @ future_impl.dart:181
handleError @ future_impl.dart:873
_propagateToListeners @ future_impl.dart:894
[_completeError] @ future_impl.dart:674
completeError @ async_patch.dart:496
_asyncRethrow @ async_patch.dart:562
(anonymous) @ app_bootstrap.dart:56
(anonymous) @ async_patch.dart:603
(anonymous) @ async_patch.dart:627
(anonymous) @ async_patch.dart:578
runBinary @ zone.dart:1666
handleError @ future_impl.dart:178
handleError @ future_impl.dart:873
_propagateToListeners @ future_impl.dart:894
[_completeError] @ future_impl.dart:674
completeError @ async_patch.dart:496
_asyncRethrow @ async_patch.dart:562
(anonymous) @ initialization.dart:35
(anonymous) @ async_patch.dart:603
(anonymous) @ async_patch.dart:627
(anonymous) @ async_patch.dart:574
runUnary @ zone.dart:1661
handleValue @ future_impl.dart:163
handleValueCallback @ future_impl.dart:861
_propagateToListeners @ future_impl.dart:890
[_completeWithValue] @ future_impl.dart:666
(anonymous) @ future_impl.dart:736
_microtaskLoop @ schedule_microtask.dart:40
_startMicrotaskLoop @ schedule_microtask.dart:49
(anonymous) @ async_patch.dart:179
Promise.then
_scheduleImmediateWithPromise @ async_patch.dart:178
_scheduleImmediate @ async_patch.dart:153
_scheduleAsyncCallback @ schedule_microtask.dart:69
_rootScheduleMicrotask @ zone.dart:1466
scheduleMicrotask @ zone.dart:1681
[_asyncCompleteWithValue] @ future_impl.dart:735
[_asyncComplete] @ future_impl.dart:695
complete @ async_patch.dart:484
_asyncReturn @ async_patch.dart:551
(anonymous) @ initialization.dart:234
(anonymous) @ async_patch.dart:603
(anonymous) @ async_patch.dart:627
_asyncStartSync @ async_patch.dart:525
initializeEngineUi @ initialization.dart:208
(anonymous) @ initialization.dart:39
(anonymous) @ async_patch.dart:603
(anonymous) @ async_patch.dart:627
_asyncStartSync @ async_patch.dart:525
(anonymous) @ initialization.dart:41
(anonymous) @ app_bootstrap.dart:57
(anonymous) @ async_patch.dart:603
(anonymous) @ async_patch.dart:627
_asyncStartSync @ async_patch.dart:525
(anonymous) @ app_bootstrap.dart:58
(anonymous) @ js_loader.dart:74
_callDartFunctionFast1 @ js_allow_interop_patch.dart:216
ret @ js_allow_interop_patch.dart:81
onEntrypointLoaded @ flutter_bootstrap.js:17
await in onEntrypointLoaded
didCreateEngineInitializer @ flutter_bootstrap.js:1
(anonymous) @ initialization.dart:52
(anonymous) @ async_patch.dart:603
(anonymous) @ async_patch.dart:627
_asyncStartSync @ async_patch.dart:525
bootstrapEngine @ initialization.dart:27
(anonymous) @ web_entrypoint.dart:19
(anonymous) @ async_patch.dart:603
(anonymous) @ async_patch.dart:627
_asyncStartSync @ async_patch.dart:525
main$ @ web_entrypoint.dart:18
(anonymous) @ main_module.bootstrap.js:23
window.$dartRunMain @ main_module.bootstrap.js:22
(anonymous) @ unknown
runMain @ client.js:9894
(anonymous) @ client.js:26180
(anonymous) @ client.js:4009
call$2 @ client.js:12381
_asyncStartSync @ client.js:3973
$call$body$main__closure @ client.js:26196
call$1 @ client.js:26109
_rootRunUnary @ client.js:4397
runUnary$2$2 @ client.js:13779
runUnaryGuarded$1$2 @ client.js:13726
_sendData$1 @ client.js:13321
_add$1 @ client.js:13267
_add$1 @ client.js:13600
_handleData$2 @ client.js:13663
_handleData$1 @ client.js:13626
(anonymous) @ client.js:1772
_rootRunUnary @ client.js:4397
runUnary$2$2 @ client.js:13779
runUnaryGuarded$1$2 @ client.js:13726
_sendData$1 @ client.js:13321
_add$1 @ client.js:13267
_sendData$1 @ client.js:13112
add$1 @ client.js:12990
(anonymous) @ client.js:1827
_rootRunUnary @ client.js:4397
runUnary$2$2 @ client.js:13779
runUnaryGuarded$1$2 @ client.js:13726
_sendData$1 @ client.js:13321
_add$1 @ client.js:13267
_sendData$1 @ client.js:13112
add$1 @ client.js:12990
add$1 @ client.js:25284
call$1 @ client.js:25731
_rootRunUnary @ client.js:4397
runUnary$2$2 @ client.js:13779
runUnaryGuarded$1$2 @ client.js:13726
_sendData$1 @ client.js:13321
perform$1 @ client.js:13502
call$0 @ client.js:13561
_rootRun @ client.js:4378
run$1$1 @ client.js:13771
runGuarded$1 @ client.js:13714
call$0 @ client.js:13909
_rootRun @ client.js:4382
run$1$1 @ client.js:13771
runGuarded$1 @ client.js:13714
call$0 @ client.js:13909
_microtaskLoop @ client.js:4241
_startMicrotaskLoop @ client.js:4247
call$1 @ client.js:12258
childList
call$1 @ client.js:12268
_scheduleAsyncCallback @ client.js:4261
_rootScheduleMicrotask @ client.js:4448
scheduleMicrotask$1 @ client.js:13826
scheduleMicrotask @ client.js:4302
schedule$1 @ client.js:13533
_addPending$1 @ client.js:13312
_sendData$1 @ client.js:13125
add$1 @ client.js:12990
call$1 @ client.js:25632
call$1 @ client.js:25548
_rootRunUnary @ client.js:4401
runUnary$2$2 @ client.js:13779
runUnaryGuarded$1$2 @ client.js:13726
call$1 @ client.js:13916
_callDartFunctionFast1 @ client.js:8307
(anonymous) @ client.js:8298
flutter_bootstrap.js:19 Uncaught (in promise) null
onEntrypointLoaded @ flutter_bootstrap.js:19
await in onEntrypointLoaded
didCreateEngineInitializer @ flutter_bootstrap.js:1
(anonymous) @ initialization.dart:52
(anonymous) @ async_patch.dart:603
(anonymous) @ async_patch.dart:627
_asyncStartSync @ async_patch.dart:525
bootstrapEngine @ initialization.dart:27
(anonymous) @ web_entrypoint.dart:19
(anonymous) @ async_patch.dart:603
(anonymous) @ async_patch.dart:627
_asyncStartSync @ async_patch.dart:525
main$ @ web_entrypoint.dart:18
(anonymous) @ main_module.bootstrap.js:23
window.$dartRunMain @ main_module.bootstrap.js:22
(anonymous) @ unknown
runMain @ client.js:9894
(anonymous) @ client.js:26180
(anonymous) @ client.js:4009
call$2 @ client.js:12381
_asyncStartSync @ client.js:3973
$call$body$main__closure @ client.js:26196
call$1 @ client.js:26109
_rootRunUnary @ client.js:4397
runUnary$2$2 @ client.js:13779
runUnaryGuarded$1$2 @ client.js:13726
_sendData$1 @ client.js:13321
_add$1 @ client.js:13267
_add$1 @ client.js:13600
_handleData$2 @ client.js:13663
_handleData$1 @ client.js:13626
(anonymous) @ client.js:1772
_rootRunUnary @ client.js:4397
runUnary$2$2 @ client.js:13779
runUnaryGuarded$1$2 @ client.js:13726
_sendData$1 @ client.js:13321
_add$1 @ client.js:13267
_sendData$1 @ client.js:13112
add$1 @ client.js:12990
(anonymous) @ client.js:1827
_rootRunUnary @ client.js:4397
runUnary$2$2 @ client.js:13779
runUnaryGuarded$1$2 @ client.js:13726
_sendData$1 @ client.js:13321
_add$1 @ client.js:13267
_sendData$1 @ client.js:13112
add$1 @ client.js:12990
add$1 @ client.js:25284
call$1 @ client.js:25731
_rootRunUnary @ client.js:4397
runUnary$2$2 @ client.js:13779
runUnaryGuarded$1$2 @ client.js:13726
_sendData$1 @ client.js:13321
perform$1 @ client.js:13502
call$0 @ client.js:13561
_rootRun @ client.js:4378
run$1$1 @ client.js:13771
runGuarded$1 @ client.js:13714
call$0 @ client.js:13909
_rootRun @ client.js:4382
run$1$1 @ client.js:13771
runGuarded$1 @ client.js:13714
call$0 @ client.js:13909
_microtaskLoop @ client.js:4241
_startMicrotaskLoop @ client.js:4247
call$1 @ client.js:12258
childList
call$1 @ client.js:12268
_scheduleAsyncCallback @ client.js:4261
_rootScheduleMicrotask @ client.js:4448
scheduleMicrotask$1 @ client.js:13826
scheduleMicrotask @ client.js:4302
schedule$1 @ client.js:13533
_addPending$1 @ client.js:13312
_sendData$1 @ client.js:13125
add$1 @ client.js:12990
call$1 @ client.js:25632
call$1 @ client.js:25548
_rootRunUnary @ client.js:4401
runUnary$2$2 @ client.js:13779
runUnaryGuarded$1$2 @ client.js:13726
call$1 @ client.js:13916
_callDartFunctionFast1 @ client.js:8307
(anonymous) @ client.js:8298

When running in a Dockerized container:
TypeError: Cannot read properties of null (reading 'toString')
    at Object.ajT (http://localhost:8080/main.dart.js:16971:3)
    at a04.$0 (http://localhost:8080/main.dart.js:51494:15)
    at http://localhost:8080/main.dart.js:28553:12
    at a_x.a (http://localhost:8080/main.dart.js:4181:63)
    at a_x.$2 (http://localhost:8080/main.dart.js:25737:14)
    at ZS.$1 (http://localhost:8080/main.dart.js:25731:21)
    at YH.VP (http://localhost:8080/main.dart.js:26317:33)
    at YH.vE (http://localhost:8080/main.dart.js:26320:13)
    at Xb.$0 (http://localhost:8080/main.dart.js:26077:11)
    at Object.mK (http://localhost:8080/main.dart.js:4276:39)

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.24.0, on Microsoft Windows [Version 10.0.22621.3880], locale en-US)
    • Flutter version 3.24.0 on channel stable at C:\repos\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 80c2e84975 (10 days ago), 2024-07-30 23:06:49 +0700
    • Engine revision b8800d88be
    • Dart version 3.5.0
    • DevTools version 2.37.2

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\244618\AppData\Local\Android\sdk
    • Platform android-34-ext10, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/windows-android-setup for more details.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✗] Visual Studio - develop Windows apps
    ✗ Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[✓] Android Studio (version 2022.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 11.0.15+0-b2043.56-9505619)

[✓] VS Code, 64-bit edition (version 1.91.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.94.0

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.3880]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 127.0.6533.100
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 127.0.2651.86

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

Labels

P3Issues that are less important to the Flutter projectc: crashStack traces logged to the consoled: docs/flutter/flutter/docs, for contributorsfound in release: 3.24Found to occur in 3.24has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-webOwned by Web platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions