-
Couldn't load subscription status.
- Fork 423
Description
I am currently working on a modular Flutter framework, and I would like to ask for your advice regarding Drift integration in this setup.
My architecture is based on separate packages:
flamework_base: contains a base database class extending _$DatabaseDrift.
flamework_customer: defines a CustomerModel extends Table and a specific database class extending the base one.
main project: imports both flamework_base and flamework_customer, and should generate the full database schema with build_runner.
Here is a simplified version of the code:
In flamework_base:
@DriftDatabase(tables: [])
class DatabaseDriftBase extends _$DatabaseDrift {
DatabaseDriftBase(super.e);
@override
int get schemaVersion => 1;
}
In flamework_customer:
class CustomerModel extends Table {
IntColumn get id => integer().autoIncrement()();
TextColumn get name => text()();
}
In the main project:
@DriftDatabase(tables: [CustomerModel])
class DatabaseDrift extends DatabaseDriftBase {
DatabaseDrift(super.e);
@override
int get schemaVersion => 2;
}
The problem I am facing is that when I run
flutter pub run build_runner build
from the main project, I get the following warning:
The referenced element, CustomerModel, is not understood by drift.