I want to create a collection like the following, but when I run flutter pub run build_runner build --delete-conflicting-outputs, I get the following error.

import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:isar/isar.dart';

part 'model.freezed.dart';
part 'model.g.dart';

@freezed
@Collection(ignore: {'copyWith'}, inheritance: false)
class Model with _$Model {
  const factory Model({
    required String address,
  }) = _Model;
  Id get id => Isar.autoIncrement;
  const Model._();
}

error:

Constructor parameter does not match a property.
|
| required String address,
|

Despite having a simple collection, I'm encountering an error and struggling. How can I resolve this error?

Additionally, while the freezed files are being generated, the .g. files for Isar are not being created.

1

There are 1 answers

0
sub On

When I remove the part inheritance: false, the .g. files are created without any issues.