Skip to content

[tool_crash] _TypeError: (#0 FlutterCommand.extractDartDefineConfigJsonMap.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1402:50)) #128787

Closed

Description

@wolfenrain

Command

flutter run --dart-define-from-file=config/base.json --dart-define-from-file=config/local.json

Steps to Reproduce

  1. Create a base.json like:
    {
        "TESTER_EMAIL": null,
        "TESTER_PASSWORD": null
    }
  2. Create a local.json like:
    {
        "TESTER_EMAIL": "some",
        "TESTER_PASSWORD": "value"
    }
  3. Run the above command with the two dart define files.

It seems to read the JSON values and fails to convert it because it does not support null values.

I expected that it would support null values by just omitting it from the dart-define.

Logs

_TypeError: (#0 FlutterCommand.extractDartDefineConfigJsonMap. (package:flutter_tools/src/runner/flutter_command.dart:1402:50))

#0      FlutterCommand.extractDartDefineConfigJsonMap.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1402:50)
#1      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13)
#2      FlutterCommand.extractDartDefineConfigJsonMap (package:flutter_tools/src/runner/flutter_command.dart:1401:16)
#3      FlutterCommand.getBuildInfo (package:flutter_tools/src/runner/flutter_command.dart:1229:54)
<asynchronous suspension>
#4      FlutterCommand._sendNullSafetyAnalyticsEvents (package:flutter_tools/src/runner/flutter_command.dart:1572:33)
<asynchronous suspension>
#5      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1556:9)
<asynchronous suspension>
#6      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1336:27)
<asynchronous suspension>
#7      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#8      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#9      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:296:9)
<asynchronous suspension>
#10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#11     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:244:5)
<asynchronous suspension>
#12     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:91:9)
<asynchronous suspension>
#13     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
�[32m[✓]�[39m Flutter (Channel stable, 3.10.0, on macOS 13.3.1 22E772610a darwin-arm64, locale en-NL)
    �[32m•�[39m Flutter version 3.10.0 on channel stable at /Users/wolfen/development/flutter
    �[32m•�[39m Upstream repository https://github.com/flutter/flutter.git
    �[32m•�[39m Framework revision 84a1e904f4 (5 weeks ago), 2023-05-09 07:41:44 -0700
    �[32m•�[39m Engine revision d44b5a94c9
    �[32m•�[39m Dart version 3.0.0
    �[32m•�[39m DevTools version 2.23.1

�[32m[✓]�[39m Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    �[32m•�[39m Android SDK at /Users/wolfen/Library/Android/sdk
    �[32m•�[39m Platform android-33, build-tools 33.0.0
    �[32m•�[39m ANDROID_HOME = /Users/wolfen/Library/Android/sdk
    �[32m•�[39m Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    �[32m•�[39m Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    �[32m•�[39m All Android licenses accepted.

�[32m[✓]�[39m Xcode - develop for iOS and macOS (Xcode 14.3.1)
    �[32m•�[39m Xcode at /Applications/Xcode.app/Contents/Developer
    �[32m•�[39m Build 14E300c
    �[32m•�[39m CocoaPods version 1.11.3

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

�[32m[✓]�[39m Android Studio (version 2022.1)
    �[32m•�[39m Android Studio at /Applications/Android Studio.app/Contents
    �[32m•�[39m Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    �[32m•�[39m Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    �[32m•�[39m Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

�[32m[✓]�[39m VS Code (version 1.78.2)
    �[32m•�[39m VS Code at /Applications/Visual Studio Code.app/Contents
    �[32m•�[39m Flutter extension version 3.66.0

�[32m[✓]�[39m Connected device (2 available)
    �[32m•�[39m macOS (desktop) • macos  • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    �[32m•�[39m Chrome (web)    • chrome • web-javascript • Google Chrome 114.0.5735.106

�[32m[✓]�[39m Network resources
    �[32m•�[39m All expected network resources are available.

�[32m•�[39m No issues found!

Flutter Application Metadata

Type: app
Version: 1.0.0+1
Material: true
Android X: false
Module: false
Plugin: false
Android package: null
iOS bundle identifier: null
Creation channel: stable
Creation framework version: 84a1e90

Activity

  1. added
    c: crashStack traces logged to the console
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Jun 13, 2023
  2. christopherfujino commented on Jun 14, 2023

    @christopherfujino
    Contributor

    @wolfenrain thanks for filing, should be an easy fix.

  3. christopherfujino commented on Jun 14, 2023

    @christopherfujino
    Contributor

    @wolfenrain actually, is the right thing to do here ignore keys whose value is null, or to forward that null?

  4. wolfenrain commented on Jun 14, 2023

    @wolfenrain
    MemberAuthor

    @wolfenrain actually, is the right thing to do here ignore keys whose value is null, or to forward that null?

    With ignore I did mean to forward it, reading those values using String.fromEnvironment already handles null and non existing values by just falling back to the provides default value

  5. github-actions commented on Jun 30, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

c: crashStack traces logged to the consoletoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions