Dart Functions for Flutter

Functions let you package multiple related lines of code into a single body that you can summon to avoid repeating those lines of code throughout your Dart application. For Example :

bool isBanana(String fruit) {
  return fruit == 'banana';
}

We can also set Default Value for Function :

bool isBanana(String fruit = "cherry") {
  return fruit == 'banana';
}
Share

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *