Answers for "dart enum"

6

dart enum

enum Status { 
   none, 
   running, 
   stopped, 
   paused 
}  
void main() { 
   print(Status.values); 
   Status.values.forEach((v) => print('value: $v, index: ${v.index}'));
   print('running: ${Status.running}, ${Status.running.index}'); 
   print('running index: ${Status.values[1]}'); 
}
Posted by: Guest on August-06-2020
2

flutter types class enum

enum CarType {
  sedan,
  suv,
  truck
}

class CarHireCompany {
  CarType storageType;

  CarHireCompany({@required this.storageType});
}
Posted by: Guest on August-18-2020
0

dart enum

[Status.none, Status.running, Status.stopped, Status.paused] 
value: Status.none, index: 0 
value: Status.running, index: 1 
value: Status.stopped, index: 2 
value: Status.paused, index: 3 
running: Status.running, 1 
running index: Status.running
Posted by: Guest on September-16-2021

Browse Popular Code Answers by Language