![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Dart
diandian82
这个作者很懒,什么都没留下…
展开
-
Dart mixin - multiple inheritance in dart class.
mixin Musical { bool canPlayPiano = false; bool canCompose = false; bool canConduct = false; void entertainMe() { if (canPlayPiano) { print('Playing piano'); } else if (canCond...原创 2019-03-06 00:47:51 · 131 阅读 · 0 评论 -
Dart Stream Sample
import 'dart:async'; Future<int> sumStream(Stream<int> stream) async{ var sum=0; await for(var value in stream){ sum += value; } return sum; } Stream<int> countStream(...原创 2019-03-30 06:24:31 · 257 阅读 · 0 评论 -
Yield* in dart
import 'dart:async'; main(List<String> args) async { await for (int i in numbersDownFrom(10)) { print('$i apples'); } } Stream numbersDownFrom(int n) async* { if (n >= 0) { a...原创 2019-03-30 07:13:50 · 1818 阅读 · 0 评论 -
singleton
// dart singleton main(List<String> args) { var helper = DBHelper(); helper = DBHelper(); helper = DBHelper(); helper = DBHelper(); helper = DBHelper(); helper = DBHelper(); hel...原创 2019-03-28 07:12:40 · 134 阅读 · 0 评论 -
Dart named constructor
class Point { num x, y; Point(); // Named constructor Point.origin() { x = 1; y = 2; } @override String toString() { // TODO: implement toString return 'x=$x, y=$y'; ...原创 2019-03-28 07:15:21 · 311 阅读 · 0 评论