Sunil Timilsina
Sunil Timilsina

Reputation: 71

Why is there two different equal operator in this line?

I am wondering what this line does? Does it means, unless widget.note is not null,
isUpdating will not be assigned? Or whatever please correct me, I am really confused about what is this line doing.

final isUpdating = widget.note != null;

Upvotes: 0

Views: 63

Answers (2)

Jim
Jim

Reputation: 7601

you can imagine

final isUpdating = widget.note != null;

is in short of

if(widget.note != null)
  isUpdating = true;
else
  isUpdating = false;

Upvotes: 5

Pranav Jadhav
Pranav Jadhav

Reputation: 118

isUpdating would be true when widget.note is not null. It would be false if widget.note is null.

Upvotes: 2

Related Questions