isOptionalPositional property

bool get isOptionalPositional

Whether this is declared as [Foo foo], which DI treats as @Optional().

Note this is deliberately not _parameter.isPositional, which is also true for required positional parameters -- the overwhelming majority of injected dependencies. Marking those optional silently swaps the injectorGet that reports a missing provider for the injectorGetOptional that returns null for one.

Implementation

bool get isOptionalPositional => _parameter.isOptionalPositional;