Skip to content

Instantly share code, notes, and snippets.

@davidmigloz
Created May 4, 2021 07:36
Show Gist options
  • Save davidmigloz/507d5859de537c459d1429a228df9dd2 to your computer and use it in GitHub Desktop.
Save davidmigloz/507d5859de537c459d1429a228df9dd2 to your computer and use it in GitHub Desktop.
Dart vs Kotlin: collection if
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