bab90a9830
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
20 lines
441 B
Dart
20 lines
441 B
Dart
enum SpeedUnit {
|
|
kmh('km/h', 1.0),
|
|
mph('mph', 0.621371),
|
|
knots('kts', 0.539957);
|
|
|
|
const SpeedUnit(this.label, this.multiplier);
|
|
|
|
final String label;
|
|
final double multiplier;
|
|
|
|
double convert(double speedMps) {
|
|
return speedMps * 3.6 * multiplier;
|
|
}
|
|
|
|
SpeedUnit get next {
|
|
final values = SpeedUnit.values;
|
|
final currentIndex = values.indexOf(this);
|
|
return values[(currentIndex + 1) % values.length];
|
|
}
|
|
} |