gpt4 book ai didi

intellij-idea - 如何在intellij idea中以 Debug模式运行flutter 'packages pub run build_runner build'?

转载 作者:行者123 更新时间:2023-12-04 06:34:45 25 4
gpt4 key购买 nike

我想在我的生成器代码上设置断点,但我不知道如何在 Debug模式下运行该命令。

我使用 source_gen 编写了生成器和 build_runner

class MyGenerator extends GeneratorForAnnotation<Todo> {
@override
FutureOr<String> generateForAnnotatedElement(
Element element, ConstantReader annotation, BuildStep buildStep) {
return "// Hey! Annotation found!";
}
}

最佳答案

  • 运行命令 flutter packages pub run build_runner build
  • 复制 build.dart到项目的根文件夹

  • enter image description here
    3)
    4) 添加新的运行配置
    enter image description here
    5)运行调试,现在你可以调试你的代码生成器了!

    关于intellij-idea - 如何在intellij idea中以 Debug模式运行flutter 'packages pub run build_runner build'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58628425/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com