Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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