I use floor as SQLite abstraction in a flutter app.
I want to save a person with a list of presents, so I created a ForeignKey (as mentioned here) and mapped child id to parent presents, but I get the error Column type is not supported for List<Present> when I run the generator via flutter packages pub run build_runner build.
I have present and person as entities.
@entity
class Present {
@PrimaryKey(autoGenerate: true)
int? id;
String name;
double? price;
Present({this.id, required this.name, this.price});
}
@Entity(tableName: 'Person', foreignKeys: [
ForeignKey(childColumns: ['id'], parentColumns: ['presents'], entity: Present)
])
class Person {
@PrimaryKey(autoGenerate: true)
int? id;
String name;
List<Present> presents;
Person({
this.id,
required this.name,
required this.presents,
});
}