编辑代码

void main() {
  print('Hello world!     - dart.jsrun.net');
  var printTest = (){
      print("this is a n fun");
  };
  Person person = new Person(12);
  print(person.age);
  Person per = Person.WithAge(13);
  Person per1 = Person.Now();
  print(per1.name);
  Dog dog = new Dog("female");
  dog._name = 'kk';
  print(dog.sex+"${dog._name}");
  Rect rect = new Rect();
  print(rect.getArea());
  var p1 = "";
  print(p1 is String);
}

class Person{
    int age;
    String name;
    Person(this.age);
    Person.Now(){
        print("person now");
    }
    Person.WithAge(this.age){
        print("person now,$age");
    }
}

class Animal{
    String _name;
}

class Dog extends Animal{
    String sex;
    Dog(this.sex);
}

class Rect{
  int height;
  int width;
  Rect():height=2,width=10{      //Dart类中的初始化列表
    print("${this.height}---${this.width}");
  }
  getArea(){
    return this.height*this.width;
  } 
}