Skip to content

Instantly share code, notes, and snippets.

@cipto-hd
Created May 30, 2020 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cipto-hd/5a7241464e34fcd941541347b66d6f12 to your computer and use it in GitHub Desktop.
Save cipto-hd/5a7241464e34fcd941541347b66d6f12 to your computer and use it in GitHub Desktop.
Using Map to describe stories flow in Dart Lang. Awesome
main() {
void nextStory(int userChoice) {
int _storyNumber = 4;
_storyNumber = {
0: {1: 2, 2: 1},
1: {1: 2, 2: 3},
2: {1: 5, 2: 4},
3: {1: 0, 2: 0},
4: {1: 0, 2: 0},
5: {1: 0, 2: 0},
}[_storyNumber][userChoice];
print(_storyNumber);
}
nextStory(2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment