Skip to content

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

@lamkr

Description

@lamkr

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)
dart-lang/tools#1211      Service.getIsolateID (dart:developer/service.dart:108)
dart-lang/tools#1212      HttpClient.enableTimelineLogging= (dart:_http:1280)
dart-lang/tools#1213      main (package:lixo/main.dart:7)
dart-lang/io#4      _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:130)
dart-lang/io#5      _rootRun (dart:async/zone.dart:1426)
dart-lang/io#6      _CustomZone.run (dart:async/zone.dart:1328)
dart-lang/io#7      _runZoned (dart:async/zone.dart:1861)
dart-lang/io#8      runZonedGuarded (dart:async/zone.dart:1849)
dart-lang/io#9      _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:126)
dart-lang/io#10     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297)
dart-lang/io#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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions