Replies: 2 comments 7 replies
-
Could you post the versions of |
Beta Was this translation helpful? Give feedback.
-
TL;DR: You should use generated data class to define the field of your entry class, instead of the class written by yourself I have the same problem. I made a reproduction and had some try on it. My conclusion is that Dart gave a wrong error message. There are my classes: class Person extends Table {
IntColumn get id => integer().autoIncrement()();
TextColumn get name => text()();
}
class Post extends Table {
IntColumn get id => integer().autoIncrement()();
IntColumn get publisher => integer().references(Person, #id)();
TextColumn get content => text()();
}
class PostEntry {
final Person person;
final Post? posts;
PostEntry(this.person, this.posts);
} The same problem occurs while using the code above. The error message is also As @simolus3 said, I'm exactly determined that But Dart gave an error still, right? I started trying to dig with it: Let's see the signature of the D readTable<T extends HasResultSet, D>(ResultSetImplementation<T, D> table)
mixin TableInfo<TableDsl extends Table, D> on Table
implements DatabaseSchemaEntity, ResultSetImplementation<TableDsl, D> and generated class class $PersonTable extends Person with TableInfo<$PersonTable, PersonData> Pay attention to the generic type But our class PostEntry {
final Person person;
final Post posts;
PostEntry(this.person, this.posts);
} Yep, the correct error message should be Changing our class PostEntry {
final PersonData person;
final PostData? posts;
PostEntry(this.person, this.posts);
} The error was dismissed "magically". If anybody wants to further dig with the bug of Dart, I could upload the whole project later and there are dependencies I used: dependencies:
drift: ^2.6.0
sqlite3_flutter_libs: ^0.5.13
path_provider: ^2.0.14
dev_dependencies:
flutter_lints: ^2.0.0
drift_dev: ^2.6.0
build_runner: ^2.3.3
|
Beta Was this translation helpful? Give feedback.
-
I followed this instruction and I have a problem here
problematic lines are these,
the error message says
What have I done wrong? How should I change it?
Acctually my longer code is this one
I tried with this one too but it made the same error
Beta Was this translation helpful? Give feedback.
All reactions