【问题标题】:Debugging Dart in Dartium - Breakpoint Keyword? [duplicate]在 Dartium 中调试 Dart - 断点关键字? [复制]
【发布时间】:2015-06-29 00:43:15
【问题描述】:

在 Chrome 开发工具中调试 Javascript 时,使用保留关键字“调试器”会在开发工具打开时导致断点命中。在 Dartium 中是否有用于调试 dart 代码的等价物?

【问题讨论】:

    标签: dart dartium


    【解决方案1】:

    从 Dart SDK 1.11.0 开始,在新的 dart:developer 库中有一个 debugger 函数可以通过代码触发断点。您可以使用when 参数传递可选条件并提供可选消息。

    import 'dart:developer';
    
    void main() {
      debugger();
      print('Not reached when a debugger is attached till the execution is continued');
    }
    

    如果编译为 JavaScript,则使用 debugger 关键字。

    【讨论】:

      猜你喜欢
      • 2018-07-09
      • 2013-09-27
      • 1970-01-01
      • 2019-12-15
      • 2018-10-29
      • 1970-01-01
      • 2016-08-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多