Skip to content

Instantly share code, notes, and snippets.

@erluxman
Last active April 13, 2020 15:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save erluxman/cc36d151ee5bbe6777760b99b5e9a6b3 to your computer and use it in GitHub Desktop.
dart functions as parameter
void main() {
function2(function1, 3);
function2(function1, 4);
function2(function1, 7);
function2(function1, 9);
}
function1(int evenOrOdd) {
print("$evenOrOdd is ${evenOrOdd % 2 == 0 ? "Even" : "Odd"}");
}
function2(Function(int) evenOrOddFunction, int argumentToPass) {
evenOrOddFunction(argumentToPass);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment