In this lesson, we will discuss the operators that are available in Dart.

First, to work with an operator, you often have to have two operands between an operator, operands are representing data.

Here is an example of how the operands will be processed to produce a value:

10 + 10

Types of Operators :

  • Arithmetic Operators
  • Equality and Relational Operators
  • Type Test Operators
  • Assignment Operators
  • Logical Operators
  • Bitwise and Shift Operators

Arithmetic operators :

‘ + ’ (addition),

‘ — ’ (subtraction),

‘ * ’ (multiplication),

‘ / ’ (division),

and ‘ % ’ (modulus division).

Operators are often used to form a numeric expression such as 5 + 5, which in this case contains two operands and the addition operator.

Equality and relational operators :

There are six relational operators that can be used to form a Boolean expression, which returns true or false :

< less than

<= less than or equal to

> greater than

>= greater than or equal to

== equal to

!= not equal to

Type test Operators :

These operators are useful for checking types at runtime.

‘ is ’ : True if the object has the specified type

‘ is! ’ : the reverse of ‘ is ’, it returns False if the object has the specified type

Assignment Operators :

An assignment statement evaluates the expression on the right side of the equal sign first and then assigns that value to the variable on the left side of the =.

In many cases assignment operator can be combined with other operators.

For example, instead of a = a+5 , we can write a += 5.

Operators :

= Assignment Operator

+= add and assign

-= subtract and assign

*= multiply and assign

/= divide and assign

Logical Operators :

Logical operators ‘ && ’ and ‘ || ’ are used to form a compound Boolean expression that tests multiple conditions.

A third logical operator ‘ is ! ’ used to reverse the state of a Boolean expression.

The logical AND operator ‘ && ’ returns a true result only when both expressions are true.

The logical OR operator ‘ || ’returns a true result when any one expression or both expressions are true.

The logical NOT operator ‘ ! ’ returns the reverse of its value. NOT true returns false, and NOT false returns true.

Bitwise and Shift Operators :

These type of operators contain those operators which are used to perform bitwise operation on the operands.

AND : &

OR : |

XOR : ^

NOT : ~

Left shift : <<

Right shift : >>

They goes like the example below :

// AND on (a) and (b)

var c = a & b;


// OR on (a) and (b)

var d = a | b;


// XOR on (a) and (b)

var e = a ^ b;


// NOT on (a)

var f = ~a;


// left shift on (a)

var g = a << b;


// right shift on (a)

var h = a >> b;


Follow me on Instagram.

Thank you.

Photographer | story teller | CS student

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store