Flutter
跨平台UI框架
CacheMiss
这个作者很懒,什么都没留下…
展开
-
Dart 空安全 ? !
Dart 空安全 ? !1 使用 ? 声明 Nullable 类型int? age;age = 10;age = null; // ????A?.B如果 A 等于 null,那么 A?.B 为 null如果 A 不等于 null,那么 A?.B 等价于 A.BA??B如果 A 等于 null,那么 A??B 为 B如果 A 不等于 null,那么 A??B 为 A2 在有把握的时候,使用 !int? maybeValue = 42;int value = maybeValue原创 2021-05-28 14:47:59 · 277 阅读 · 0 评论 -
Dart中的Isolate
IsolateIsolate中文意思是隔离,是 Dart 中的线程。在 Dart 中 async 和 Future 无法解决所有耗时的工作。Isolate虽好,但也有合适的使用场景,不建议滥用Isolate,每当我们创建出来一个新的 Isolate 至少需要 2mb 左右的空间甚至更多。方法执行在几毫秒或十几毫秒左右的,应使用Future如果一个任务需要几百毫秒或之上的,则建议创建单独的Isolate创建IsolateIsolate由一对分别由用于接收消息的ReceivePort对象,和用原创 2021-05-16 00:30:18 · 379 阅读 · 0 评论