dart - 在 flutter 中使用 Mixins

标签 dart flutter

我无法在我的 flutter 应用程序中使用 mixins,它说:

The class 'UserModel' can't be used as a mixin because it extends a class other than Object

error

最佳答案

很长一段时间以来,官方都不可能将 mixins 与 extends 的东西混在一起。

最近启用了它,但使用了另一种语法:

mixin UserModel on Model {
  // do some stuff
}

关于dart - 在 flutter 中使用 Mixins,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53541880/

相关文章:

firebase - 使用哪种方法来保存游戏数据并在 Flutter 中显示它们?

firebase - Firestore : Getting a subcollection from a DocumentSnapshot

flutter - Dart 空安全 - 如何禁用某些文件的空安全分析?

flutter - 如何在Flutter中的Matrix Gesture Detector小部件中重置矩阵的比例?

dart - 使用 SharedPreferences 设置登录状态并在 App 启动时检索它 - Flutter

Flutter ElevatedButton 不继承 ButtonThemeData 形状

Flutter - 添加边框时半径边框消失

android - 在 Flutter 中调整手机亮度

flutter - 如何在 Flutter 中重新加载 Navigation.pop 上的页面?

node.js - STRAPI 是否有助于开发 REST api 以轻松且经济有效地连接 Flutter 应用程序