Dart教程
-
Dart编程概述-Dart教程|
Dart是一种面向对象的语言,具有C风格的语法,可以选择将其编译成JavaScript。它支持各种编程辅助工具,如接口,类,集合,泛型和可选类...
-
Dart编程实例-更新一个列表-Dart实例教程|
Dart编程实例 - 更新一个列表 void main () { List l = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ]; print ( The value of list before replacing ${ l } ); l . replaceRange ( 0 , 3 ,[...
-
Dart编程实例-位运算符-Dart实例教程|
Dart编程实例 - 位运算符 void main () { var a = 2 ; // Bit presentation 10 var b = 3 ; // Bit presentation 11 var result = ( a b ); print ( (a b) = ${ result } ); result = ( ...
-
Dart编程实例-null值-Dart实例教程|
Dart编程实例 - null值 void main () { int num ; print ( num ); }...
-
Dart编程实例-条件表达式-Dart实例教程|
Dart编程实例 - 条件表达式 void main () { var a = 10 ; var res = a 12 ? value greater than 10 : value lesser than or equal to 10 ; print ( res ); }...
-
Dart编程实例-同步-Dart实例教程|
Dart编程实例 - 同步 import dart:isolate ; void foo ( var message ){ print ( execution from foo ... the message is : ${ message } ); } void main (){ Isolate . spawn ( foo , Hel...
-
Dart编程实例-异步-Dart实例教程|
Dart编程实例 - 异步 import dart:io ; void main () { print ( Enter your name : ); // prompt for user input String name = stdin . readLineSync (); // this is a synchronous metho...
-
Dart编程实例-封装错误-Dart实例教程|
Dart编程实例 - 封装错误 library loggerlib ; void _log ( msg ) { print ( Log method called in loggerlib msg: $ msg ); }...
-
Dart编程实例-导入和使用库-Dart实例教程|
Dart编程实例 - 导入和使用库 import dart:math ; void main () { print ( Square root of 36 is: ${ sqrt ( 36 ) } ); }...
-
Dart编程实例-Typedefs类型定义-Dart实例教程|
Dart编程实例 - Typedefs 类型定义 typedef ManyOperation ( int firstNo , int secondNo ); //function signature Add ( int firstNo , int second ){ print ( Add result is ${ firstN...
-
Dart编程实例-Typedef类型定义-Dart实例教程|
Dart编程实例 - Typedef 类型定义 typedef ManyOperation ( int firstNo , int secondNo ); //function signature Add ( int firstNo , int second ){ print ( Add result is ${ firstNo...
-
Dart编程实例-添加断点-Dart实例教程|
Dart编程实例 - 添加断点 void main () { int a = 10 , b = 20 , c = 5 ; c = c * c * c ; print ( $ a + $ b = ${ a + b } ); print ( $ a % $ b = ${ a % b } ); // Add a break point...
-
Dart编程实例-自定义异常-Dart实例教程|
Dart编程实例 - 自定义异常 class AmtException implements Exception { String errMsg () = Amount should be greater than zero ; } void main () { try { withdraw_amt ( - 1 ); } c...
-
Dart编程实例-抛出异常-Dart实例教程|
Dart编程实例 - 抛出异常 main () { try { test_age ( - 2 ); } catch ( e ) { print ( Age cannot be negative ); } } void test_age ( int age ) { if ( age 0 ) { throw new FormatEx...
-
Dart编程实例-异常处理Finally块-Dart实例教程|
Dart编程实例 - 异常处理Finally 块 main () { int x = 12 ; int y = 0 ; int res ; try { res = x ~/ y ; } on IntegerDivisionByZeroException { print ( Cannot divide by zero ); }...
-
Dart编程实例-on…catch-Dart实例教程|
Dart编程实例 - oncatch main () { int x = 12 ; int y = 0 ; int res ; try { res = x ~/ y ; } on IntegerDivisionByZeroException catch ( e ) { print ( e ); } }...
-
Dart编程实例-异常处理使用catch块-Dart实例教程|
Dart编程实例 - 异常处理 使用catch块 main () { int x = 12 ; int y = 0 ; int res ; try { res = x ~/ y ; } catch ( e ) { print ( e ); } }...
-
Dart编程实例-异常处理使用ON块-Dart实例教程|
Dart编程实例 - 异常处理 使用 ON 块 main () { int x = 12 ; int y = 0 ; int res ; try { res = x ~/ y ; } on IntegerDivisionByZeroException { print ( Cannot divide by zero )...
-
Dart编程实例-泛型Map-Dart实例教程|
Dart编程实例 - 泛型 Map void main () { Map String , String m = { name : Tom , Id : E1001 }; print ( Map : ${ m } ); }...
-
Dart编程实例-泛型Queue-Dart实例教程|
Dart编程实例 - 泛型 Queue import dart:collection ; void main () { Queue int queue = new Queue int (); print ( Default implementation ${ queue . runtimeType } ); queue . addLas...