“Dart Enum” Code-Antworten

Fluttertypen Klassenumum

enum CarType {
  sedan,
  suv,
  truck
}

class CarHireCompany {
  CarType storageType;

  CarHireCompany({@required this.storageType});
}
loonix

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]}'); 
}
Bole

Dart Enums

enum Water {
  frozen(32),
  lukewarm(100),
  boiling(212);
  
  final int value;
  const Water(this.value);
}

void main() {
  print(Water.value)
}
Adorable Alpaca

Ähnliche Antworten wie “Dart Enum”

Fragen ähnlich wie “Dart Enum”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen