by @kodeazy
flutter how to implement arrow functions in flutter?
In this blog we will discuss on how to implement arrow functions in flutter
Non Arrow Function Example.
import 'dart:convert';
int multi(int a, int b){
return a*b;
}
void main() {
int result=multi(2,3);
print(result);
}
Output:
6
Arrow Function Example.
Arrow Function
is a function that just contains one expression
inside a function.
=>
is used in Arrow Functions
.
In the below example we can see only one statement between =>
and ;
.
import 'dart:convert';
int multi(int a, int b)=>a*b;
void main() {
int result=multi(2,3);
print(result);
}
output
6