Closed xiaocode337317439 closed 1 year ago
CC @scheglov
InterfaceType.element2
is InterfaceElement
, and will be in future version not only ClassElement
, but also EnumElement
, or MixinElement
. Right now both are also ClassElement
, but we will separate them in the next breaking changes version. I think you might use InterfaceElement
methods, without casting to ClassElement
.
InterfaceType.element2
isInterfaceElement
, and will be in future version not onlyClassElement
, but alsoEnumElement
, orMixinElement
. Right now both are alsoClassElement
, but we will separate them in the next breaking changes version. I think you might useInterfaceElement
methods, without casting toClassElement
.
How should DartType be converted to InterfaceType?
InterfaceType.element2
isInterfaceElement
, and will be in future version not onlyClassElement
, but alsoEnumElement
, orMixinElement
. Right now both are alsoClassElement
, but we will separate them in the next breaking changes version. I think you might useInterfaceElement
methods, without casting toClassElement
.How should DartType be converted to InterfaceType?
TypeChecker(List).isExactly((ParameterElement.type as InterfaceElement))
error => type 'ParameterElementImpl' is not a subtype of type 'InterfaceElement' in type cast
You don't convert, you check if it is InterfaceType
, using if (myType is InterfaceType) {...}
. It might be something different, e.g. FunctionType
.
You don't convert, you check if it is
InterfaceType
, usingif (myType is InterfaceType) {...}
. It might be something different, e.g.FunctionType
.
Thank you for answering
Darttype. element as ClassElement Not sure how to convert to ClassElement after using element2 ?