How to check that DartType of Element is custom type?

223 Views Asked by At

DartType from analyzer package have some properties: isDartCoreNum, isDartCoreInt, isDartCoreDouble

How to do check DartType is custom type (DartType represents Employee or Bus NOT int or double)?

This is necessary for I need to discover FieldElement type during analyze of code. How to do it?

1

There are 1 best solutions below

0
On

You can use TypeChecker from source_gen.
ie:

TypeChecker.fromRuntime(Employee).isAssignableFromType(myType);