DVModelAdmin<T> class

Generated CRUD admin for one model.

The model supplies the four operations — list, blank, save, delete — and its own generated form; this is the screen around them. It is deliberately not model-aware: every type-specific decision arrives as a callback, so the generator emits one call rather than a screen per model.

Every action is asked of DV.Auth.authorization as T.create, T.update or T.delete on the record it would touch. An action the policy refuses is not drawn, and each is asked again at the moment it writes, so a button drawn before a role was removed still writes nothing. An action no policy answers is refused, as every unanswered policy is.

Inheritance

Constructors

DVModelAdmin({Key? key, Object? as, required String title, required Future<List<T>> load(), required Future<T> save(T model), required Future<void> destroy(T model), required T blank(), required String label(T model), required Widget form(T model, void onSubmit(T edited))})
const

Properties

as → Object?
Who the policy is asked about: the application's own user, such as the generated User a policy written the specification's way takes.
final
blank → T Function()
A new, empty record — what "New" opens.
final
destroy → Future<void> Function(T model)
Removes a record.
final
form → Widget Function(T model, void onSubmit(T edited))
The model's generated form, wired to call onSubmit with the edited value.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label → String Function(T model)
How a record is identified in the list.
final
load → Future<List<T>> Function()
Every stored record.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
save → Future<T> Function(T model)
Upserts a record. Returns what was stored.
final
title → String
What the model is called, for the heading.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<DVModelAdmin<T>>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

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