Skip to content

Document grammar of type literals on Type. #62158

@acarstoiu

Description

@acarstoiu

I, for one, could not find a syntax accepted by the Dart parser that makes it possible to write a Type literal corresponding to a nullable type. For example, how would you compare a type parameter T to String?, because the natural expression

... T == String? ...

doesn't cut it for the parser, even when enclosed in parantheses❓

I had to write the condition like this

Type typeAsValue<Q>() => Q;
...
{
... T == typeAsValue<String?>() ...
}

I did check if this grammar issue was already reported - apparently not, which is also a surprise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-coretype-documentationA request to add or improve documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions