Skip to content

Instantly share code, notes, and snippets.

@ridhoperdana
Created December 21, 2020 23:06
Show Gist options
  • Save ridhoperdana/968a0df70a3affa070e3b1432e5f2d1a to your computer and use it in GitHub Desktop.
Save ridhoperdana/968a0df70a3affa070e3b1432e5f2d1a to your computer and use it in GitHub Desktop.
example of callback function in dart
class Car {
String get type {
return 'Hatchback';
}
}
String carFactory() {
return Car().type;
}
String produceVehicle(Function factory) {
var vehicle = factory();
return 'Vehicle $vehicle is created successfully';
}
void main() {
print(produceVehicle(carFactory));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment