Skip to content

Commit f4bda4f

Browse files
authored
fix: Example23 class When used as a mixin, it throws an error.
Before Dart 2.1: Use a regular class without a constructor as a mixin. It is recommended to use mixin for the new project
1 parent 5134e57 commit f4bda4f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

zh-cn/dart.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,9 @@ example22() {
327327
// Mixin 主要是用来和辅助的类共享方法的,
328328
// 这样单一继承就不会影响代码复用。
329329
// Mixin 声明在类定义的 "with" 关键词后面。
330+
// 在 Dart 2.1 之前:把一个普通的、没有构造函数的 class 当作 mixin 使用。新项目推荐使用 mixin
330331
class Example23A {}
331-
class Example23Utils {
332+
mixin Example23Utils {
332333
addTwo(n1, n2) {
333334
return n1 + n2;
334335
}

0 commit comments

Comments
 (0)