Created
May 4, 2021 07:36
-
-
Save davidmigloz/507d5859de537c459d1429a228df9dd2 to your computer and use it in GitHub Desktop.
Dart vs Kotlin: collection if
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
void main() { | |
final children = [ | |
"Header", | |
if (hasBody1()) "Body1" else "Body2", | |
"Footer", | |
]; | |
} | |
bool hasBody1() => Random().nextBool(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment