typedef and Callbacks
typedef names a function type so callbacks read clearly.
Example
typedef Op = int Function(int, int);
int run(Op f, int a, int b) => f(a, b);
print(run((a, b) => a + b, 2, 3));
print(run((a, b) => a * b, 2, 3));Exercise
Name a type.
Op = int Function(int);Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.