Skip to content

Instantly share code, notes, and snippets.

@sdkdeepa
Last active March 20, 2023 07:07
Show Gist options
  • Save sdkdeepa/1f200a781f29b59dd2ab204b9bf9c926 to your computer and use it in GitHub Desktop.
Save sdkdeepa/1f200a781f29b59dd2ab204b9bf9c926 to your computer and use it in GitHub Desktop.
Functions in dart

Functions in Dart

//void returns nothing
//main() is the first method that dart will look for
void main() {
String greet = greetings();
int age = getAge();
print(greet);
print(age);
}
// functions which returns a string
// String greetings() {
// return 'Welcome to Flutter Basics';
// }
// // functions which returns an int
// int getAge() {
// return 25;
// }
// Arrow function if returns a single value
String greetings() => 'Welcome to Flutter Basics';
int getAge() => 25;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment