// functions in dart are objects and have a typeintadd(inta,intb){returna+b;}// functions can be assigned to variablesintsum=add(2,3);// returns: 5// can be passed as arguments to other functionsinttotalSum=add(2,add(2,3));// returns : 7
Arrow Syntax (=>)
// functions that contain just one expression, you can use a shorthand syntaxboolisFav(Productproduct)=>favProductsList.contains(product);
Anonymous (lambda) functions
// small one line functions that dont have nameintadd(a,b)=>a+b;// lambda functions mostly passed as parameter to other functionsconstlist=['apples','bananas','oranges'];list.forEach((item)=>print('${list.indexOf(item)}: $item'));//Prints: 0: apples 1: bananas 2: oranges