Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

[BUG] --reporter=json for check-unnecessary-nullable crashes, saying Converting object to an encodable object failed: Instance of 'MappedIterable<FormalParameter, String>' #979

Closed
@fzyzcjy

Description

@fzyzcjy

Looks like the fix can be simple: Just make FormalParameter serializable?

(base) ➜  second dart run dart_code_metrics:metrics check-unnecessary-nullable lib --monorepo --reporter=json
Unhandled exception:
Converting object to an encodable object failed: Instance of 'MappedIterable<FormalParameter, String>'
#0      _JsonStringifier.writeObject (dart:convert/json.dart:794:7)
#1      _JsonStringifier.writeMap (dart:convert/json.dart:875:7)
#2      _JsonStringifier.writeJsonValue (dart:convert/json.dart:830:21)
#3      _JsonStringifier.writeObject (dart:convert/json.dart:785:9)
#4      _JsonStringifier.writeList (dart:convert/json.dart:842:7)
#5      _JsonStringifier.writeJsonValue (dart:convert/json.dart:824:7)
#6      _JsonStringifier.writeObject (dart:convert/json.dart:785:9)
#7      _JsonStringifier.writeMap (dart:convert/json.dart:875:7)
#8      _JsonStringifier.writeJsonValue (dart:convert/json.dart:830:21)
#9      _JsonStringifier.writeObject (dart:convert/json.dart:785:9)
#10     _JsonStringifier.writeList (dart:convert/json.dart:842:7)
#11     _JsonStringifier.writeJsonValue (dart:convert/json.dart:824:7)
#12     _JsonStringifier.writeObject (dart:convert/json.dart:785:9)
#13     _JsonStringifier.writeMap (dart:convert/json.dart:875:7)
#14     _JsonStringifier.writeJsonValue (dart:convert/json.dart:830:21)
#15     _JsonStringifier.writeObject (dart:convert/json.dart:785:9)
#16     _JsonStringStringifier.printOn (dart:convert/json.dart:983:17)
#17     _JsonStringStringifier.stringify (dart:convert/json.dart:968:5)
#18     JsonEncoder.convert (dart:convert/json.dart:345:30)
#19     JsonCodec.encode (dart:convert/json.dart:231:45)
#20     UnnecessaryNullableJsonReporter.report (package:dart_code_metrics/src/analyzers/unnecessary_nullable_analyzer/reporters/reporters_list/json/unnecessary_nullable_json_reporter.dart:26:32)
#21     CheckUnnecessaryNullableCommand.runCommand (package:dart_code_metrics/src/cli/commands/check_unnecessary_nullable_command.dart:55:11)
<asynchronous suspension>
#22     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#23     CliRunner.run (package:dart_code_metrics/src/cli/cli_runner.dart:53:7)
<asynchronous suspension>
#24     main (file:///Users/tom/.pub-cache/hosted/pub.flutter-io.cn/dart_code_metrics-4.17.1/bin/metrics.dart:4:3)
<asynchronous suspension>
  • Dart code metrics version:
  • Dart sdk version:

Please show your full configuration:

Configuration

What did you do? Please include the source code example causing the issue.

What did you expect to happen?

What actually happened?

Are you willing to submit a pull request to fix this bug?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions