## Dart编程实例 - 函数参数```dartvoid main() { test_param(123,this is a string);} test_param(int n1,String s1) { print(n1); print(s1);}```
## Dart编程实例 - 可选位置参数```dartvoid main() { test_param(123);} test_param(n1,[s1]) { print(n1); print(s1);}```
## Dart编程实例 - 可选命名参数```dartvoid main() { test_param(123); test_param(123,s1:hello); test_param(123,s2:hello,s1:world);} test_param(n1,{s1,s2}) { print(n1);
## Dart编程实例 - 可选参数和默认值```dartvoid main() { test_param(123);} void test_param(n1,{s1:12}) { print(n1); print(s1);}```
## Dart编程实例 -递归函数```dartvoid main() { print(factorial(6));} factorial(number) { if (number = 0) { // termination case return 1; } else {
## Dart编程实例 - Lambda 表达式```dartvoid main() { printMsg(); print(test());} printMsg()=print(hello);int test()=123; // returning function
## Dart编程实例 - 实现一个接口```dartvoid main() { ConsolePrinter cp= new ConsolePrinter(); cp.print_data();} class Printer { void print_data() { print(__________Print
## Dart编程实例 - 实现多个接口```dartvoid main() { Calculator c = new Calculator(); print(The gross total : ${c.ret_tot()}); print(Discount :${c.ret_dis()});} class Calculat
## Dart编程实例 - 访问属性和函数```dartvoid main() { Car c= new Car(); c.disp();} class Car { // field String engine = E1001; // function void disp()
## Dart编程实例 - 构造函数```dartvoid main() { Car c = new Car(E1001);}class Car { Car(String engine) { print(engine); }}```