Logical Operators

on Saturday, 25th of July, 2020

Logical operators in Dart as similar to most languages. They can be used to combine or invert boolean expressions.

OperatorMeaning
&&logical AND
||logical OR
!exprinvert boolean

example use:

bool isSnowing = true;
bool isRaining = false;

assert(!isRaining); // true
assert(isSnowing || isRaining); // true because at least one is true
assert(isSnowing && !isRaining); // true because both are true


Join thousands of Flutter developers.

Sign up for infrequent updates about Flutter and Dart.

You can get all this content and more in one place. Check out my new book Flutter in Action