UAdminFields class
Owns the TextEditingControllers (and FocusNodes) a dialog or page creates, and tears them down exactly once, when the widget that shows them is disposed.
Admin dialogs build a dozen controllers per open. Created bare they are never
disposed, so every reopen leaks the whole set. Create them through a bag and
hand the dialog's root widget to scope, which disposes the bag from its own
State.dispose() — after the closing route has finished its exit transition,
which is what makes this safe where a bare dispose() after await is not.
final UAdminFields f = UAdminFields();
final TextEditingController title = f.text(p?.title);
await UNavigator.dialog(f.scope(StatefulBuilder(builder: ...)));
A bag held by a State instead of a dialog is disposed from that state:
final UAdminFields f = UAdminFields();
@override
void dispose() {
f.dispose();
super.dispose();
}
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void - Disposes everything the bag owns. Safe to call more than once.
-
focus(
) → FocusNode - A FocusNode owned by this bag.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
scope(
Widget child) → Widget -
Wraps
childso this bag is disposed whenchildleaves the tree. -
text(
[String? text]) → TextEditingController -
A TextEditingController seeded with
text, owned by this bag. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited