Dread Boy
Dread Boy

Reputation: 722

Disable strict/checked mode in Dart Angular

I'm using WebStorm and Dart Angular and I'm having trouble with some kind of strict or checked mode.

Whenever I run the application using default WebStorm configuration, I get failed assertions Observer reaction functions should not change model., boolean expression must not be null and type 'SubListIterable' is not a subtype of type 'List<Tag>'.

As far as I understand, this is happening because Dart VM is running in checked mode and I would like to turn it off. Dartium is launched with options --no-sandbox --flag-switches-begin --flag-switches-end, if it is important.

When I open the page in Chrome, everything's fine but of course I can't debug.

EDIT: 1st error is apparently not related to checked mode. Here is a snippet of what I try to achieve:

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

Current solution is like this:

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;
}

and I have to set invalidateCorrectTags to true in each setter, where changes in said setter will affect result of getCorrectTags. Is there a better of way of doing it?

Upvotes: 0

Views: 341

Answers (1)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 658017

The option to disable checked mode was removed recently from WebStorm

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

A mentioned workaround is to add

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

to [configuration]/options/web-browsers.xml

Upvotes: 2

Related Questions