Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cover assert() in the Dart 2.0 page #355

Closed
kwalrath opened this issue Aug 10, 2017 · 7 comments · Fixed by #716
Closed

Cover assert() in the Dart 2.0 page #355

kwalrath opened this issue Aug 10, 2017 · 7 comments · Fixed by #716
Milestone

Comments

@kwalrath
Copy link
Contributor

In Dart 1.x, assert() works only in checked mode. But checked mode is obsolete in Dart 2.0. The Dart 2.0 Updates page should say how assert() will work in 2.0.

@chalin
Copy link
Contributor

chalin commented Nov 9, 2017

To give a bit more context, in the Assert section of the Language Tour it is written:

Note: Assert statements work only in checked mode. They have no effect in production mode.

Dart 2.0 note: Checked mode won’t be in Dart 2.0. For more information, see Dart 2.0 Updates.

@munificent, @floitschG - has it been decided how assert() will be handled in Dart 2? I'll be reworking some of the example code and I was wondering if I should drop the use of asserts in favor of something else.

cc @kevmoo @filiph

@floitschG
Copy link

We will still have a second mode to enable asserts.

I think the easiest is to call it "debug" mode.

@kwalrath
Copy link
Contributor Author

Tracking bug: dart-lang/sdk#32255

@kwalrath
Copy link
Contributor Author

--enable-asserts will work for dart & dart2js. dartdevc always has asserts enabled. We won't call it a separate mode, iirc, just talk about how you use asserts.

@kwalrath
Copy link
Contributor Author

@filiph how does assert() work in Flutter?

@kwalrath kwalrath added this to the 2-beta2 milestone Mar 29, 2018
@filiph
Copy link
Contributor

filiph commented Mar 29, 2018

Currently, assert works in debug mode, and is an important part of the developer experience (asserts are everywhere in the framework, so that you get early feedback).

I haven't checked, but I assume in release mode asserts are off. Paging @Hixie to confirm that this is the case and that it won't change in the foreseeable future.

@Hixie
Copy link
Contributor

Hixie commented Mar 29, 2018

yeah i don't expect that to change.

kwalrath added a commit that referenced this issue Mar 29, 2018
Also fixed some random issues I happened to notice, mostly wrt API doc
URLs and the link to `dart`.

Fixes #355
kwalrath added a commit that referenced this issue Mar 29, 2018
* Update assert and checked mode info

Also fixed some random issues I happened to notice, mostly wrt API doc
URLs and the link to `dart`.

Fixes #355
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants