I'v bean learning about Flutter these days. There are many problems in the process of learning.For example,The Dart SDK un available Because the computer system reinstalled yesterday.
So before I start learning today,I have to reinstall Dart SDK for a long time.
Use this time to review Dart's grammar.
OK, Let's review now.
First of all,I'll write a smiple Dart program
Like many programming languages, Dart includes classes and functions and various type of data
My program will use them
void main()=>myEnter();
void myEnter(){
print(sum(3,2,4));
new A().fun();
}
num sum(int d,e,double f ,{int a=1,var b:3,double c=2.2}){
return a+b+c+d+e+f;
}
class A{
var a;
A(){
a='hello world';
}
fun(){
print(a);
}
}
1)When there is only one line in the method ,you can use => to shorthand.
2)Method may not have to be in a class.
3)Parameters can be undeclared,written in brackets must use equal sign to specify the default value