Skip to content

[web-server] Pressing 'o' key crashes flutter tools with null check error in debugTogglePlatform #185766

Description

@briskbase-projects

Flutter version

Flutter 3.41.7 stable

Command

flutter run -d web-server --web-port 5555 --web-hostname 0.0.0.0

Steps to Reproduce

  1. Run: flutter run -d web-server --web-port 5555
  2. Wait for app to start
  3. Press 'o' key in the terminal

Expected behavior

Either platform toggle works, or shows a message that it's not supported on web-server.

Actual behavior

Flutter tools crash entirely with: "Null check operator used on a null value"

Stack trace

flutter_01.log

#0      ResidentHandlers.debugTogglePlatform (package:flutter_tools/src/resident_runner.dart:925:74)
#1      TerminalHandler._commonTerminalInputHandler (package:flutter_tools/src/resident_runner.dart:1822:31)
#2      TerminalHandler.processTerminalInput (package:flutter_tools/src/resident_runner.dart:1906:13)
#3      _rootRunUnary (dart:async/zone_root.dart:48:47)
#4      _CustomZone.runUnary (dart:async/zone.dart:733:19)
#5      _CustomZone.runUnaryGuarded (dart:async/zone.dart:633:7)
#6      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381:11)
#7      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312:7)
#8      _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:385:25)
#9      _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:257:5)
#10     _AsBroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:488:11)
#11     _rootRunUnary (dart:async/zone_root.dart:48:47)
#12     _CustomZone.runUnary (dart:async/zone.dart:733:19)
#13     _CustomZone.runUnaryGuarded (dart:async/zone.dart:633:7)
#14     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381:11)
#15     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312:7)
#16     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:67:11)
#17     _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)
#18     _StringAdapterSink.add (dart:convert/string_conversion.dart:228:11)
#19     _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:233:7)
#20     _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:313:20)
#21     _ErrorHandlingAsciiDecoderSink.addSlice (dart:convert/ascii.dart:285:17)
#22     _ErrorHandlingAsciiDecoderSink.add (dart:convert/ascii.dart:271:5)
#23     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:70:18)
#24     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:115:24)
#25     _rootRunUnary (dart:async/zone_root.dart:48:47)
#26     _CustomZone.runUnary (dart:async/zone.dart:733:19)
#27     _CustomZone.runUnaryGuarded (dart:async/zone.dart:633:7)
#28     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381:11)
#29     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312:7)
#30     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:798:19)
#31     _StreamController._add (dart:async/stream_controller.dart:663:7)
#32     _StreamController.add (dart:async/stream_controller.dart:618:5)
#33     _Socket._onData (dart:io-patch/socket_patch.dart:2874:41)
#34     _rootRunUnary (dart:async/zone_root.dart:56:13)
#35     _CustomZone.runUnary (dart:async/zone.dart:733:19)
#36     _CustomZone.runUnaryGuarded (dart:async/zone.dart:633:7)
#37     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381:11)
#38     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312:7)
#39     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:798:19)
#40     _StreamController._add (dart:async/stream_controller.dart:663:7)
#41     _StreamController.add (dart:async/stream_controller.dart:618:5)
#42     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:2312:31)
#43     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1647:14)
#44     _microtaskLoop (dart:async/schedule_microtask.dart:40:35)
#45     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
#46     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:127:13)
#47     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:194:5)```

## Flutter Doctor -v Output

```console
[√] Flutter (Channel stable, 3.41.7, on Microsoft Windows [Version 10.0.26200.8039], locale en-US) [889ms]
    • Flutter version 3.41.7 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cc0734ac71 (2 weeks ago), 2026-04-15 21:21:08 -0700
    • Engine revision 59aa584fdf
    • Dart version 3.11.5
    • DevTools version 2.54.2
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android,
      enable-ios, cli-animations, enable-native-assets, omit-legacy-version-file, enable-lldb-debugging,
      enable-uiscene-migration

[√] Windows Version (Windows 11 or higher, 25H2, 2009) [3.8s]

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [13.1s]
    • Android SDK at C:\Android
    • Emulator version unknown
    • Platform android-36, build-tools 35.0.0
    • Java binary at: C:\Program Files\Eclipse Adoptium\jdk-17.0.18.8-hotspot\bin\java.exe
      This JDK was found in the system PATH.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Temurin-17.0.18+8 (build 17.0.18+8)
    • All Android licenses accepted.

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

[X] Visual Studio - develop Windows apps [421ms]
    X 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

[√] Connected device (3 available) [1,251ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26200.8039]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 146.0.7680.178
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 147.0.3912.86

[√] Network resources [2.5s]
    • All expected network resources are available.

! Doctor found issues in 1 category.```

## Flutter Application Metadata
**Type**: app
**Version**: 0.1.0+1
**Material**: true
**Android X**: false
**Module**: false
**Plugin**: false
**Android package**: null
**iOS bundle identifier**: null
**Creation channel**: stable
**Creation framework version**: cc0734ac716fbb8b90f3f9db8020958b1553afa7
### Plugins
image_picker_ios-0.8.13+6
path_provider_foundation-2.6.0
url_launcher_ios-6.4.1
flutter_plugin_android_lifecycle-2.0.34
image_picker_android-0.8.13+16
jni-1.0.0
jni_flutter-1.0.1
path_provider_android-2.3.1
url_launcher_android-6.3.29
file_selector_macos-0.9.5
image_picker_macos-0.2.2+1
url_launcher_macos-3.2.5
file_selector_linux-0.9.4
image_picker_linux-0.2.2
path_provider_linux-2.2.1
url_launcher_linux-3.2.2
file_selector_windows-0.9.3+5
image_picker_windows-0.2.2
path_provider_windows-2.3.0
url_launcher_windows-3.1.5
image_picker_for_web-3.1.1
url_launcher_web-2.4.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consolehas reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    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