
dart
litter_lj
这个作者很懒,什么都没留下…
展开
-
Dart入门
1.dart的入口文件main(List<String> args) {} // main方法里面就是入口文件2.变量和常量// 变量double name= 1.234;String c= "10.1";var name= "张三"; //会自动识别类型// 常量const a= 123; // new DateTime.now()在const里...原创 2019-06-16 13:59:09 · 145 阅读 · 0 评论 -
Dart学习笔录 函数
1.函数的定义String printInfo(String info){ return info;}// 方法名 printInfo// 返回值的类型是String 类似typescript// 参数的类型是String方法写在main(){}方法之外,在main()里面执行void main(){ print(printInfo("这是个函数"));}...原创 2019-06-22 14:03:25 · 139 阅读 · 0 评论 -
Dart学习笔录 类
1.类的属性和方法class Person{ String name="张三"; //属性 int age; //属性 //方法 void printInfo(){ print("${this.name}"); }}main(List<String> args) { Person p=new Person(); p.printInf...原创 2019-06-22 15:15:25 · 108 阅读 · 0 评论 -
Dart学习笔录 继承,多态,接口,混入
1.继承Animal.dart:class Animal{ String name; Animal(this.name); Animal.name(String name){ this.name="animal命名构造函数${name}"; } void printInfo(){ print("Animal:${this.name}"); } ...原创 2019-06-22 17:31:57 · 743 阅读 · 0 评论 -
Dart泛型
1.方法的泛型// 泛型不局限于某种类型,还能进行类型的验证T getData<T>(T value){ return value;}void setData<T>(T value, String name){ print("${value} ${name}");}main(List<String> args) { print(...原创 2019-06-22 17:49:43 · 783 阅读 · 0 评论 -
Dart的基础类型 例子总结
import 'package:flutter/material.dart';class DataType extends StatefulWidget { @override _DataTypeState createState() => _DataTypeState();}class _DataTypeState extends State<DataType&g...原创 2019-08-13 18:17:39 · 166 阅读 · 0 评论 -
Dart 例子实战 标准构造函数,可选参数,默认参数,初始化列表,命名构造函数,工厂构造函数,命名工厂构造函数,get,set,静态方法,抽象方法,抽象类,泛型,dart编程小技巧
1.标准构造函数,可选参数,默认参数,初始化列表,命名构造函数,工厂构造函数,命名工厂构造函数,get,set,静态方法,抽象方法,抽象类//所有的类都继承自Objectclass Person { String name; int age; Person(this.name, this.age); //标准构造方法 @override String toStrin...原创 2019-08-14 18:17:24 · 4218 阅读 · 0 评论