0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Missing concrete implementations of 'getter mixin _$Title on Object.content', 'getter mixin _$Title on Object.cover', and 'getter mixin _$Title on Object.title'. Try implementing the missing methods, or make the class abstract

Posted at

発生したエラー

titles.dart
Missing concrete implementations of 'getter mixin _$Title on Object.content', 'getter mixin _$Title on Object.cover', and 'getter mixin _$Title on Object.title'.
Try implementing the missing methods, or make the class abstract

環境

  • freezed: ^3.2.3
  • freezed_annotation: ^3.1.0
  • build_runner: ^2.9.0

試したこと

エラー文通りにabstractを付けるとエラーは消える

  • classの型が変わってるけどこれベストプラクティスなのか...?

.freezeファイルの生成が上手くいかずに破損した可能性を疑う

  • flutter pub run build_runner build --delete-conflicting-outputsの実行
  • Dart: Restart Analyze Serverの実行
  • flutter clean
  • .freezeファイルの削除と再作成
  • VSCodeの再起動

調べる

@freezed
sealed class Usual with _$Usual {
  factory Usual({int a}) = _Usual;
}

New: Mixed mode
Freezed 3.0 is about supporting a "mixed mode".
https://pub.dev/packages/freezed/changelog#300---2025-02-25

  • 2025年2月のアップデートでclassdeprecatedになったぽく、abstract classsealed classにしてください。と公式が声明を出していました。
  • sealed classの方が厳密で同ファイルのものしかアクセスを許可せず、余計なサブクラスを作ってくれないみたいなので、自分のプロジェクトにはこっちが合ってそうでした。

謝辞

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?