extending property

Type? extending
final

The parent type of the data class generated by drift.

The extending type must refer to an interface type (usually just a class name), and the parent class must extend DataClass.

The extended class can optionally have a type parameter, which is instantiated to the actual data class generated by drift.

For example,

 abstract class BaseModel extends DataClass {
   abstract final String id;
 }

 abstract class TypedBaseModel<T> extends DataClass {

 }

 @DataClassName('Company', extending: BaseModel)
 class Companies extends Table {
   TextColumn get id => text()();
   TextColumn get name => text().named('name')();
 }

 // The actual generated class will extend `TypedBaseModel<Employee>`.
 @DataClassName('Employee', extending: TypedBaseModel)
 class Employees extends Table {
   TextColumn get id => text()();
 }

Implementation

final Type? extending;