Skip to main content

Dart 3.x.x

  • Dart 3.x.x

Typedef

  • Similar a records
    // Dart program to show the usage of typedef

// Defining alias name
typedef GeeksForGeeks(int a, int b);

// Defining Geek1 function
Geek1(int a, int b) {
print("This is Geek1");
print("$a and $b are lucky geek numbers !!");
}

// Defining a function with a typedef variable
number(int a, int b, GeeksForGeeks geek) {
print("Welcome to GeeksForGeeks");
geek(a, b);
}

// Main Function
void main() {
// Calling number function
number(21, 23, Geek1);
}

Extension Type | Dart