Flutter 如何在用';冷冻';图书馆?

Flutter 如何在用';冷冻';图书馆?,flutter,dart,Flutter,Dart,我定义了这样一个类,并用 @冻结 @不变的 抽象类CommentMediaAttachmentModel与$CommentMediaAttachmentModel{ const factory CommentMediaAttachmentModel({ 最终字符串类型, 最后一个字符串mediaUrl, 最终整数宽度, 最终整数高度 })=\u CommentMediaAttachmentModel; bool isAnimated(){ 返回类型=='已设置动画'; } } 我想添加一个快

我定义了这样一个类,并用

@冻结
@不变的
抽象类CommentMediaAttachmentModel与$CommentMediaAttachmentModel{
const factory CommentMediaAttachmentModel({
最终字符串类型,
最后一个字符串mediaUrl,
最终整数宽度,
最终整数高度
})=\u CommentMediaAttachmentModel;
bool isAnimated(){
返回类型=='已设置动画';
} 
}
我想添加一个快速函数
isAnimated
,以确定
类型
变量,但在编译时,它不允许我这样做:

lib/presentation/comment/model/comment_attachment_model.freezed.dart:292:7: Error: The non-abstract class '_$_CommentMediaAttachmentModel' is missing implementations for these members:
 - CommentMediaAttachmentModel.isAnimated
Try to either
 - provide an implementation,
 - inherit an implementation from a superclass or mixin,
 - mark the class as abstract, or
 - provide a 'noSuchMethod' implementation.
检查生成的类
\uu$\u CommentMediaAttachmentModel
isAnimated
函数未实现。我怎样才能做到这一点

编辑:下面是
\u$\ uCommentMediaAttachmentModel
的代码。 我不知道为什么我不能粘贴那个片段,它只是说代码格式不正确。我将使用屏幕截图:

基本上,您也需要在
\uu$CommentMediaAttachmentModel
中实现
的动画化。因为它是
abstract
类的
mixin

使用u$commentMediaAttachmentModelFreeze的代码生成,而
\u$CommentMediaAttachmentModel
是生成的类。每当OP出于任何原因再次运行
build\u runner
时,对类本身的任何修改都将被撤消。您所遇到的错误不是
@freezed
的错误,而是抽象类的错误,要求您在
.$CommentMediaAttachmentModel
中实现
isAnimated
函数