Skip to content

Instantly share code, notes, and snippets.

@MelbourneDeveloper
Created May 11, 2023 22:30
Show Gist options
  • Save MelbourneDeveloper/1528d67474e7e37f1a90bc08de8ce12d to your computer and use it in GitHub Desktop.
Save MelbourneDeveloper/1528d67474e7e37f1a90bc08de8ce12d to your computer and use it in GitHub Desktop.
Multiple Values and when
(int a, int b) returnMulti() => (1, 2);
void main() {
var numbers = returnMulti();
var dayNumber = switch (numbers) {
(int a, int b) when a == 1 && b == 2 => 'One and Two',
(_, _) => 'Default'
};
print(dayNumber);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment