Skip to content

assert should take an optional message #6190

Closed
@johnniwinther

Description

@johnniwinther

Currently the assert statement cannot provide any runtime information about what went wrong. Adding an addition message argument to the assert statement could provide such runtime information. For instance

assert(foo.isBar(), '$foo is not Bar');

could provide runtime information about the particalur foo instance that failed and not only, as now, that some foo instance failed. Such additional information would be valuable in debugging failed assertions.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).closed-duplicateClosed in favor of an existing reportcustomer-fluttertype-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions