DVModel class

Annotation metadata for a Dartvel data model.

The generator adds serialization and model behavior to the annotated class; this annotation intentionally does not provide a fake runtime model.

Constructors

DVModel({bool searchable = false, bool billable = false, int? nativePrice, DVModelPageDataMode pageDataMode = DVModelPageDataMode.auto, bool generatePublicPages = true, DVPublicPathsResolver? publicPathsResolver, String? schemaType, String? favicon, bool tenantScoped = false, Object? subject, DVRetention? retain, DVHistory? history, bool capture = false, bool semantic = false, DVConflict? offline, bool version = true, bool softDelete = false, DVModelAccess? access, List<DVIndex> indexes = const <DVIndex>[]})
const
DVModel.featuredImage()
Marks the field a generated model page uses as its featured image: @DVModel.featuredImage().
const
DVModel.hideFromPage()
Excludes the field from generated model pages: @DVModel.hideFromPage().
const
DVModel.mainContent()
Marks the field a generated model page renders as its main text content: @DVModel.mainContent().
const
DVModel.model3dField({bool poster = true, int? maxSizeMb, int? maxTriangles})
Marks a field as a 3D asset: @DVModel.model3dField().
const
DVModel.pageOrder(int order)
Sets where the field appears among a generated page's remaining fields: @DVModel.pageOrder(3).
const
DVModel.pageTitle()
Marks the field a generated model page uses as its title: @DVModel.pageTitle().
const
DVModel.retain({required int years, required String because})
Marks the field whose row a law requires to be kept: @DVModel.retain(years: 7, because: 'tax law').
const
DVModel.searchableField()
Marks a model field for generated search indexing: @DVModel.searchableField().
const
DVModel.sensitiveField({bool encrypted = false, bool showInForms = false, bool showInAdmin = false, DVErase onErase = DVErase.delete})
Marks a model field as sensitive: @DVModel.sensitiveField().
const
DVModel.uniqueField()
Marks a field no two records may share: @DVModel.uniqueField().
const
DVModel.validate({num? min, num? max, int? minLength, int? maxLength, String? pattern})
The rules a field's value has to meet before it is stored: @DVModel.validate(minLength: 3, maxLength: 120).
const

Properties

access → DVModelAccess?
Who may read, create, change and delete records through the model's data API, for a model that says so here rather than in a @DVPolicy class. Studio stores the same rules for a model designed there.
final
billable → bool
final
capture → bool
Whether every write to this model is recorded as a change.
final
encrypted → bool
Field-scoped metadata, set only by the named field constructors below.
final
favicon → String?
The favicon this model's generated pages wear, or null for the application's.
final
generatePublicPages → bool
Whether the generator emits public pages, and static paths for them during static generation, from this model's published records.
final
hashCode → int
The hash code for this object.
no setterinherited
history → DVHistory?
The model's change log: DVHistory(keep: Duration(days: 365)), or null for none.
final
indexes → List<DVIndex>
The indexes the model asks its database for, beyond its key.
final
isModel3dField → bool
Whether this field holds a 3D asset, set by @DVModel.model3dField().
final
max → num?
final
maxLength → int?
final
min → num?
@DVModel.validate(...): the smallest and largest number, the shortest and longest text, and a pattern the whole text matches.
final
minLength → int?
final
model3dMaxSizeMb → int?
A 3D field's upload ceiling, in mebibytes.
final
model3dMaxTriangles → int?
A 3D field's triangle budget.
final
model3dPoster → bool
Whether a 3D field asks for a still of its model, for where 3D cannot render.
final
nativePrice → int?
final
offline → DVConflict?
How a write made on a device that could not reach the server is resolved when it is replayed. Set, the model gets a local store and a server side built from the table, key and columns it already declares, so neither is written out a second time.
final
onErase → DVErase
What an erasure does to a sensitive field, set by @DVModel.sensitiveField(onErase: ...).
final
pageDataMode → DVModelPageDataMode
How generated Model.Page(...) resolves its data by default.
final
pageOrderIndex → int?
Where this field sits among a generated page's remaining fields, set by @DVModel.pageOrder(n). Lower comes first.
final
pageRole → DVModelPageRole?
The part this field plays in a generated model page, when one of the page-composition field constructors set it.
final
pattern → String?
final
publicPathsResolver → DVPublicPathsResolver?
Supplies the path values static generation should render for this model's parameterized route, when the default enumeration is not what is wanted.
final
retain → DVRetention?
How long this model's rows are kept: DVRetention.days(90), then deleted or anonymized, or DVRetention.indefinite, deliberately.
final
retainBecause → String?
final
retainYears → int?
Set by @DVModel.retain(years:, because:) on a field a law requires to be kept: an erasure keeps the row, anonymizes its personal fields, and names retainBecause as the reason.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
schemaType → String?
The schema.org type this model's public page is, such as Product, Article or Person.
final
searchable → bool
final
semantic → bool
Whether this model has a semantic index. On, its searchable fields are embedded when a record is saved and semanticSearch answers from the vectors; the embedder and the vector store are configured once with the model's own useSemanticSearch. Off, nothing is embedded.
final
showInAdmin → bool
final
showInForms → bool
final
softDelete → bool
Whether deleting marks the row rather than removing it. Queries skip a marked row, Model.withDeleted reads it, and Model.restore(id) brings it back.
final
subject → Object?
How this model's rows reach the person they belong to, for erasure and export: DVSubject.self when a row is the person, #field for the field holding the person's id, or DVSubject.through('column', parent: 'Model') for a row that belongs to them through another model's row.
final
tenantScoped → bool
Whether this model's rows belong to a tenant.
final
unique → bool
@DVModel.uniqueField(): no two records hold the same value here.
final
version → bool
Whether every write is checked against the version it read: on by default, because a lost update is silent. version: false is for append-only data whose writes never contend, and says so here.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited