"when" replacement with new switch #970
KoalityJustin
started this conversation in
General
Replies: 1 comment
-
|
Executing functions in the switch statement wont allow the syntax to be as clean as we like. You'd just have to use a regular switch statement without assigning it to a variable : switch (result) {
case ExampleSuccessResult(:final dateFinished):
await box.put(migration.key, DateTime.now());
break;
case ExampleFailureResult(:final errors, :final dateFinished):
errors.map(print);
break;
};
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Dart 3's syntax for switches is just so utterly confusing to me that I can't seem to figure out the "Dart" way to do this:
where result's type is like:
I've tried doing like:
but that just throws analyzer warning when
build_runnerruns.Is there a Dart 3 switch way of running a switch and executing statements without needing to do something silly like:
Beta Was this translation helpful? Give feedback.
All reactions