Created
April 24, 2022 17:46
-
-
Save felipecastrosales/f9c053bb7146b65e356a8bb5918de291 to your computer and use it in GitHub Desktop.
Closure in Dart
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
// ignore_for_file: prefer_function_declarations_over_variables | |
void main() { | |
String message = 'Interessante'; | |
print('Antes: $message'); | |
Function showMessage = () { | |
message = 'Boto fé'; | |
print('Depois: $message'); | |
}; | |
showMessage(); | |
Function present = () { | |
String welcome = 'Dale'; | |
print('Antes: $welcome'); | |
Function say = () { | |
welcome = 'Welcome'; | |
print('Depois: $welcome'); | |
}; | |
return say; | |
}; | |
Function speak = present(); | |
speak(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment