EN_raw_non_bool_operand
-
Toolschevron_right -
Diagnosticschevron_right -
non_bool_operand non_bool_operand
Details about the 'non_bool_operand' diagnostic produced by the Dart analyzer.
more_vert
-
copyCopy link -
bug_reportReport issue
The operands of the operator '{0}' must be assignable to 'bool'.
Description
#
The analyzer produces this diagnostic when one of the operands of either
the `&&` or `||` operator doesn't have the type `bool`.
Example
#
The following code produces this diagnostic because `a` isn't a Boolean
value:
dart
int a = 3;
bool b = a || a > 1;
content_copy
Common fixes
#
Change the operand to a Boolean value:
dart
int a = 3;
bool b = a == 0 || a > 1;
content_copy
Was this page's content helpful?
thumb_up
thumb_down
Unless stated otherwise, the documentation on this site reflects Dart 3.13.3. Report an issue.