Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 飞镖,飞镖。我的MainModel类与其他4个类一起从作用域_模型包的模型继承。_Flutter - Fatal编程技术网

Flutter 飞镖,飞镖。我的MainModel类与其他4个类一起从作用域_模型包的模型继承。

Flutter 飞镖,飞镖。我的MainModel类与其他4个类一起从作用域_模型包的模型继承。,flutter,Flutter,刚开始工作,但在我进行了一些颤振升级后,它会显示一条错误消息。 我当前的颤振版本,0.10.2 类MainModel使用ConnectedProductsModel、UserModel、ProductsModel、UtilityModel{}扩展模型错误消息:“类‘UserModel’不能用作混入,因为它扩展了对象以外的类。”您需要在代码中更改某些内容 打开ConnectedProductsModel.dart文件并进行更改 class ConnectedProductsModel extend

刚开始工作,但在我进行了一些颤振升级后,它会显示一条错误消息。 我当前的颤振版本,0.10.2


类MainModel使用ConnectedProductsModel、UserModel、ProductsModel、UtilityModel{}扩展模型错误消息:“类‘UserModel’不能用作混入,因为它扩展了对象以外的类。”

您需要在代码中更改某些内容

打开ConnectedProductsModel.dart文件并进行更改

class ConnectedProductsModel extends Model class ProductsModel extends ConnectedProductsModel class UserModel extends ConnectedProductsModel class UtilityModel extends ConnectedProductsModel 类ConnectedProductsModel扩展了模型 类ProductsModel扩展了ConnectedProductsModel 类UserModel扩展了ConnectedProductsModel 类实用程序模型扩展了ConnectedProductsModel 到

mixin ConnectedProducts模型上的模型 在ConnectedProductsModel上混合ProductsModel ConnectedProductsModel上的mixin用户模型 ConnectedProductsModel上的mixin实用程序模型
在末尾的“pubspec.yaml”文件中包含以下代码:

analyzer:
strong-mode: true
language:
enableSuperMixins: true

在根文件夹中打开名为analysis_options.yaml的文件,然后将这些行代码放入该文件,然后重新启动IDE

# https://www.dartlang.org/guides/language/analysis-options
analyzer:
  strong-mode: true
  errors:
    mixin_inherits_from_not_object: ignore

谢谢,它起作用了。但是我不懂mixin,你能给我解释一下吗?我在dart语言论坛上找到了一个解释:
# https://www.dartlang.org/guides/language/analysis-options
analyzer:
  strong-mode: true
  errors:
    mixin_inherits_from_not_object: ignore