DriftView class Null safety

An annotation specifying view properties

  • @Target({TargetKind.classType})


DriftView({String? name, String? dataClassName, Type? extending})
Customize view name and data class name


dataClassName String?
The name for the data class that will be generated for the view class. The data class is a dart object that will be used to represent a result of the view. {@template drift_custom_data_class} By default, drift will attempt to use the view name followed by "Data" when naming data classes (e.g. a view named "UserView" will generate a data class called "UserViewData"). By default, drift will attempt to use the singular form of the table name when naming data classes (e.g. a table named "Users" will generate a data class called "User"). However, this doesn't work for irregular plurals and you might want to choose a different name, for which this annotation can be used.
extending Type?
The parent class of generated data class. Class must extends DataClass!
hashCode int
The hash code for this object. [...]
read-only, inherited
name String?
The sql view name to be used. By default, drift will use the snake_case representation of your class name as the sql view name. For instance, a View class named UserView will be called user_view by default.
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]