Answers for "flutter switch case two values"

7

flutter switch case

switch (value) {
  case 0:
    // do something
    break;
  case 1: 
    // do something else
    break;
}
Posted by: Guest on October-28-2021
0

dart switch case multiple

String commentMark(int mark) {
    switch (mark) {
        case 0 : // Enter this block if mark == 0
            return "mark is 0" ;
        case 1:
        case 2:
        case 3: // Enter this block if mark == 1 or mark == 2 or mark == 3
            return "mark is either 1, 2 or 3" ;
        // etc.
        default :
            return "mark is not 0, 1, 2 or 3" ;
    }
}
Posted by: Guest on August-18-2021

Code answers related to "Dart"

Browse Popular Code Answers by Language