我正在尝试制作一个具有数据库的应用程序,它有一个学生表
class Students extends Table{
IntColumn get RollNumber=>integer().autoIncrement()();
TextColumn get Name => text().withLength(min: 3,max:32)();
Students( String name){
Name==name;
}
@UseMoor(tables: [Students])
class myDatabase extends _$myDatabase {
myDatabase() : super(_openConnection());
@override
int get schemaVersion => 1;
// loads all student entries
Future<List<Student>> getAllStudents() => select(students).get();
//Watches all entries in Students and automatically
//emits new data when data changes
Stream<List<Student>> watchAllStudents()=> select(students).watch();
Future insertStudent(Student student )=>into(students).insert(student);
//Future UpdateStudent(Student student )=>update(students).replace(student);
//Future DeleteStudent(Student student )=>into(students).insert(student);
}
现在我尝试将更改通知器与myDatabase一起使用,但在这里我无法扩展它,所以我尝试这样做
class myDatabase extends _$myDatabase with ChangeNotifier{
..
}
但是学生类显示错误。现在我不知道如何进行。