Created with <3 with dartpad.dev.
Last active
September 7, 2022 15:44
-
-
Save Chralu/9f182bf72693a92dd077d44cb2c270bd to your computer and use it in GitHub Desktop.
Flutter101 - Block/Expression body
This file contains 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
// Copyright (c) 2022, TheTribe.io | |
/// Exemple de fonction avec un Expression body | |
/// Notez la syntaxe "=>" | |
String getTextWithExpressionBody() => "Bonjour tout le monde"; | |
/// Exemple de fonction avec un Block body | |
/// Elle est strictement équivalente à [getTextWithExpressionBody] | |
String getTextWithBlockBody() { | |
return "Bonjour tout le monde"; | |
} | |
void main() { | |
final helloWorldText1 = getTextWithExpressionBody(); | |
print(helloWorldText1); | |
final helloWorldText2 = getTextWithBlockBody(); | |
print(helloWorldText2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment