Home > OS >  parentheses error in flutter tired to solve it myself and researched it but it was no use
parentheses error in flutter tired to solve it myself and researched it but it was no use

Time:11-24

ı am having a problem with the parentheses ı added a photo of where it gives the error and the error code itselferror code my code

ı was just trying to convert string to int and assigning the values for the later part of the project

CodePudding user response:

The if condition will take a boolean, and dont use end line. The format will be

if( slot1==true ){ ....}

Or just do

if(slot1){ ....}

Same goes for else if(slot2){...}

CodePudding user response:

As I've seen you're setting your if else conditions with a semi-colon ;, and this is wrong, you need to remove them, in addition, that the equality condition is made with double ==

if(1   1 == 2;) // wrong
if(1   1 = 2) // wrong
if(1   1 = 2;) // wrong
if(1   1 == 2) // right

you need to correct it in all your if else statements.

in your case, your if conditions should be like this:

if(slot1 == true) // right

This should fix your issue.


Optional recommendation:

However, for boolean have which are true, consider using them directly without specifying that they should equal true with a double == because they are already true in the first place.

if(slot1) // right also
  • Related