
dart
鸣蜩二九~
一岁有一岁的味道,一站有一站的风景。
花会沿路盛开,以后的路也是。
展开
-
flutter中dart语言之‘$‘的使用
字符串可以通过 ${expression} 的方式内嵌表达式。 如果表达式是一个标识符,则 {} 可以省略。 在 Dart 中通过调用就对象的 toString() 方法来得到对象相应的字符串。 var s = 'string interpolation'; assert('Dart has $s, which is very handy.' == 'Dart has string interpolation, ' + 'which is very handy.'); assert原创 2021-08-08 19:28:56 · 3397 阅读 · 0 评论 -
dart中子类继承父类时,构造函数的问题
class A { num? x, y, z; A() { //第一个构造函数 print(1); this.x = 1; this.y = 2; this.z = 3; } A.now() { //第二个,多个构造函数自己选 this.x = 2; print(2); } } //子类继承父类时,父类中必须要有一个 class B extends A { num? x1, y1, z1; B(this.x1, this.y1, t原创 2021-07-13 08:28:32 · 794 阅读 · 0 评论