0

I am working with Code-Generation and trying to get the path of the Annotated-File.

I would need it inside the visitFieldElement:

  @override
  dynamic visitFieldElement(FieldElement element) {
    // Get path here
  }

I tried couple of different things: element.source, elenment.librarySource, element.location.

But non of them is giving me the exact path relativ from lib/.

I know I can simply extract it from e.g the element.location but I thought there must be a cleaner way to get this done.

It should be possible since the builder itself is printing out the path:

enter image description here

Any idea? Let me know if you need any more info!

Chris
  • 1,828
  • 6
  • 40
  • 108

1 Answers1

0

If you have an element to use via visiting children, then I believe you do have the "buildStep" variable, it contains the "path" variable and I think that is what you are looking for.

Epool Ranggi
  • 211
  • 1
  • 7