mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 19:12:31 +08:00
refactor: Modernize switch; use switch-expressions and no break; (#3133)
Replaces the switch cases that can be replaces with switch expressions and removes `break;` where it isn't needed. https://dart.dev/language/branches#switch-statements
This commit is contained in:
@ -18,16 +18,12 @@ class Inverter extends BaseNode implements NodeInterface {
|
||||
}
|
||||
|
||||
void _invertStatus() {
|
||||
switch (child.status) {
|
||||
case NodeStatus.notStarted:
|
||||
status = NodeStatus.notStarted;
|
||||
case NodeStatus.running:
|
||||
status = NodeStatus.running;
|
||||
case NodeStatus.success:
|
||||
status = NodeStatus.failure;
|
||||
case NodeStatus.failure:
|
||||
status = NodeStatus.success;
|
||||
}
|
||||
status = switch (child.status) {
|
||||
NodeStatus.notStarted => NodeStatus.notStarted,
|
||||
NodeStatus.running => NodeStatus.running,
|
||||
NodeStatus.success => NodeStatus.failure,
|
||||
NodeStatus.failure => NodeStatus.success,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user