io icon indicating copy to clipboard operation
io copied to clipboard

Exception in HttpClient.enableTimelineLogging: type 'Null' is not a subtype of type 'String' of 'function result'

Open lamkr opened this issue 2 years ago • 1 comments

When running the source below in Flutter, the error "type 'Null' is not a subtype of type 'String' of 'function result'" occurs in the line io.HttpClient.enableTimelineLogging = true;

void main() {
  // enable network traffic logging
  HttpClient.enableTimelineLogging = true;
  runApp(MyApp());
}

I relied on this reference: Announcing Flutter 1.17

And this only occurs in versions compiled as release: flutter build linux -tlib/main.dart --release (it occurs also in Android),

Stacktrace:

[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: type 'Null' is not a subtype of type 'String' of 'function result'
#0      _getIsolateIDFromSendPort (dart:developer-patch/developer.dart)
#1      Service.getIsolateID (dart:developer/service.dart:108)
#2      HttpClient.enableTimelineLogging= (dart:_http:1280)
#3      main (package:lixo/main.dart:7)
#4      _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:130)
#5      _rootRun (dart:async/zone.dart:1426)
#6      _CustomZone.run (dart:async/zone.dart:1328)
#7      _runZoned (dart:async/zone.dart:1861)
#8      runZonedGuarded (dart:async/zone.dart:1849)
#9      _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:126)
#10     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297)
#11     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192)
$ flutter --version
Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision fb57da5f94 (3 weeks ago) • 2022-05-19 15:50:29 -0700
Engine • revision caaafc5604
Tools • Dart 2.17.1 • DevTools 2.12.2
$ flutter doctor -v:
[✓] Flutter (Channel stable, 3.0.1, on Ubuntu 20.04.4 LTS 5.8.0-63-generic, locale en_US.UTF-8)
    • Flutter version 3.0.1 at /home/luciano/fvm/versions/3.0.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fb57da5f94 (3 weeks ago), 2022-05-19 15:50:29 -0700
    • Engine revision caaafc5604
    • Dart version 2.17.1
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /home/luciano/apps/android/
    • Platform android-32, build-tools 32.1.0-rc1
    • ANDROID_HOME = /home/luciano/apps/android
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] 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 (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] IntelliJ IDEA Community Edition (version 2022.1)
    • IntelliJ at /snap/intellij-idea-community/366
    • Flutter plugin version 67.1.4
    • Dart plugin version 221.5591.58

[✓] VS Code (version 1.67.2)
    • VS Code at /usr/share/code
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Ubuntu 20.04.4 LTS 5.8.0-63-generic

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

! Doctor found issues in 2 categories.

lamkr avatar Jun 06 '22 15:06 lamkr

I can confirm that this still happens on linux release build. Debug build runs fine. [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'String' of 'function result' #0 _getIsolateIdFromSendPort (dart:developer-patch/developer.dart) #1 Service.getIsolateId (dart:developer/service.dart:109)

~/git/flutterapp$ flutter doctor -v

[✓] Flutter (Channel stable, 3.16.9, on Ubuntu 22.04.4 LTS 5.15.0-101-generic, locale en_US.UTF-8)

• Flutter version 3.16.9 on channel stable at /home/mc/flutter/flutter_3.16.9

• Upstream repository https://github.com/flutter/flutter.git

• Framework revision 41456452f2 (10 weeks ago), 2024-01-25 10:06:23 -0800

• Engine revision f40e976bed

• Dart version 3.2.6

• DevTools version 2.28.5

[✗] Android toolchain - develop for Android devices

✗ Unable to locate Android SDK.

  Install Android Studio from: https://developer.android.com/studio/index.html

  On first launch it will assist you in installing the Android SDK components.

  (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

  If the Android SDK has been installed to a custom location, please use

  `flutter config --android-sdk` to update to that location.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)

! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Linux toolchain - develop for Linux desktop

• Ubuntu clang version 14.0.0-1ubuntu1.1

• cmake version 3.22.1

• ninja version 1.10.1

• pkg-config version 0.29.2

[!] Android Studio (not installed)

• Android Studio not found; download from https://developer.android.com/studio/index.html

  (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] VS Code (version unknown)

• VS Code at /snap/code/current

• Flutter extension can be installed from:

  🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

✗ Unable to determine VS Code version.

[✓] Connected device (1 available)

• Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.4 LTS 5.15.0-101-generic

[✓] Network resources

• All expected network resources are available.

! Doctor found issues in 3 categories.

mrclauss avatar Apr 01 '24 09:04 mrclauss