hive icon indicating copy to clipboard operation
hive copied to clipboard

Parent class private fields are not generated

Open gruvw opened this issue 3 years ago • 0 comments

Code sample

class Animal {
  @HiveField(0)
  int _info;

  Animal(this._info);
}

@HiveType(typeId: 0)
class Cat extends Animal {
  @HiveField(1)
  String name;

  Cat(super._info, {required this.name});

  Cat.create(this.name) : super(0);
}

This generates an error when generating the type adapter: 1 positional argument(s) expected, but 0 found.

In the generated adapter:

return Cat(
  name: fields[1] as String,
);

Version

  • Platform: iOS, Android, Mac, Windows, Linux, Web
  • Flutter version: 3.0.3
  • Hive version: 2.2.1

gruvw avatar Jun 27 '22 08:06 gruvw