簡體   English   中英

在Dart Angular中禁用嚴格/檢查模式

[英]Disable strict/checked mode in Dart Angular

我正在使用WebStorm和Dart Angular,但在某種嚴格或檢查模式下遇到問題。

每當我使用默認的WebStorm配置運行該應用程序時,我都會收到失敗的斷言Observer reaction functions should not change model. boolean expression must not be nulltype 'SubListIterable' is not a subtype of type 'List<Tag>'

據我了解,這是因為Dart VM正在檢查模式下運行,我想將其關閉。 如果Dartium很重要,它會使用--no-sandbox --flag-switches-begin --flag-switches-end選項啟動。

當我在Chrome中打開頁面時,一切都很好,但是我當然無法調試。

編輯:第一個錯誤顯然與檢查模式無關。 這是我嘗試實現的代碼片段:

List get getCorrectTags {
  if(this.allowTags)
    return this.tags.map((t) => t.name).toList();
  else
    return this.contentTags;
}

當前的解決方案是這樣的:

bool invalidateCorrectTags = false;
List correctTags = [];
List get getCorrectTags {

  if (this.invalidateCorrectTags) {
    this.invalidateCorrectTags = false;
    if(this.allowTags)
      this.correctTags  = this.tags.map((t) => t.name).toList();
    else
      this.correctTags = this.contentTags;
  }

  return this.correctTags;
}

並且我必須在每個設置器中將invalidateCorrectTags設置為true ,其中所述設置器中的更改將影響getCorrectTags的結果。 有更好的方法嗎?

最近從WebStorm中刪除了禁用檢查模式的選項

https://youtrack.jetbrains.com/issue/WEB-24466

提到的解決方法是添加

<entry key="DART_FLAGS" value="--checked" />

[configuration]/options/web-browsers.xml

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM