断言没有与pub serve一起执行

时间:2017-02-27 14:15:50

标签: dart

以下代码无法执行:

assert((){ print('hi'); });

终端日志:

pub serve
Loading source assets... 
Loading angular2 and dart_to_js_script_rewriter transformers... 
Serving checkoutFrontEduzz web on http://localhost:8080
Build completed successfully
[web] GET Served 11 cached assets.
[web] GET Served 634 cached assets.
[web] GET Served 2 cached assets.
[web] GET assets/css/hotsite.component.css.map → (cached) checkoutFrontEduzz|web/assets/css/hotsite.component.css.map

我的pubspec:

transformers:
- angular2:
    platform_directives:
    - 'package:angular2/common.dart#COMMON_DIRECTIVES'
    - 'package:angular2/common.dart#FORM_DIRECTIVES'
    platform_pipes:
    - 'package:angular2/common.dart#COMMON_PIPES'
    entry_points: web/main.dart
    resolved_identifiers:
        BrowserClient: 'package:http/browser_client.dart'
        Client: 'package:http/http.dart'
- dart_to_js_script_rewriter

带有铬和镖的Teste。

1 个答案:

答案 0 :(得分:0)

要在Dartium中获取断言错误,您需要确保它在启用了检查模式的情况下运行

DART_FLAGS='--checked' path/chrome

另见https://webdev.dartlang.org/tools/dartium

pub serve产生生产输出,因为调试输出在我记忆中运行得太慢,因此预期的行为是你没有在Chrome中得到错误。您需要运行pub build --mode="debug"并在Chrome中加载输出才能收到错误。