Created
June 30, 2025 16:22
-
-
Save bradmartin333/0ae6535bfda8b5b22de4da0e9e8f9849 to your computer and use it in GitHub Desktop.
dart ternary formatting example
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'; | |
enum AppRoute { root, login, welcome } | |
void main() { | |
final randomNumberGenerator = Random(); | |
final isAuthenticated = randomNumberGenerator.nextBool(); | |
final hasSeenWelcome = randomNumberGenerator.nextBool(); | |
final initialLocation = isAuthenticated | |
? AppRoute.root | |
: hasSeenWelcome | |
? AppRoute.login | |
: AppRoute.welcome; | |
print(initialLocation); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment