Skip to content

Why does DartObject.toMapValue has DartObject? has key/value, but DartObject.toListValue has a non-nullable DartObject? #60529

Open
@rrousselGit

Description

@rrousselGit

Using analyzer, consider:

DartObject obj;
List<DartObject> list = obj.toListValue()!;
Set<DartObject> list = obj.toSetValue()!;
Map<DartObject?, DartObject?> map = obj.toMapValue()!;

It feels inconsistent that toListValue/toSetValuehave non-nullable elements, buttoMapValue` has nullable ones.

Could toMapValue be made to return Map<DartObject, DartObject>??

Metadata

Metadata

Assignees

No one assigned

    Labels

    analyzer-apiIssues that impact the public API of the analyzer packagearea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-questionA question about expected behavior or functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions