DVModel.sensitiveField constructor

const DVModel.sensitiveField({
  1. bool encrypted = false,
  2. bool showInForms = false,
  3. bool showInAdmin = false,
  4. DVErase onErase = DVErase.delete,
})

Marks a model field as sensitive: @DVModel.sensitiveField().

By default a sensitive field is excluded from public serialization (toPublicJson), generated model pages/tables/cards, search indexing, analytics, traces, and logs, and requires explicit policy authorization before it can be sent to clients. Use showInForms/showInAdmin to opt specific generated UI surfaces back in.

In forms it is write-only, like a password field: Model.Form() and the Studio record form show an obscured input that always starts empty. A value typed there is saved, and an empty one keeps the stored value. showInForms makes it an ordinary, readable form field instead.

encrypted seals the value with AES-256-GCM before it reaches the database and opens it on the way back, under the keyring in DARTVEL_FIELD_KEYS — a server-process environment variable, because generated model code compiles into the application bundle too and a key held anywhere the generator writes would ship to every visitor. Only String and String? can carry it, it cannot go on the field generated lookups use, and with no keyring configured the field raises rather than falling back to plaintext — so a model carrying one is persisted by the server, and saving or reading it against a device's own database gets that refusal. See DVFieldCipher.

Implementation

const DVModel.sensitiveField({
  this.encrypted = false,
  this.showInForms = false,
  this.showInAdmin = false,
  this.onErase = DVErase.delete,
}) : access = null,
     indexes = const <DVIndex>[],
     unique = false,
     min = null,
     max = null,
     minLength = null,
     maxLength = null,
     pattern = null,
     searchable = false,
     subject = null,
     history = null,
     capture = false,
     semantic = false,
     offline = null,
     version = true,
     softDelete = false,
     retain = null,
     retainYears = null,
     retainBecause = null,
     billable = false,
     nativePrice = null,
     pageDataMode = DVModelPageDataMode.auto,
     generatePages = true,
     publicPathsResolver = null,
     pageRole = null,
     pageOrderIndex = null,
     schemaType = null,
     favicon = null,
     tenantScoped = false,
     isModel3dField = false,
     model3dPoster = false,
     model3dMaxSizeMb = null,
     model3dMaxTriangles = null;