DevbarPanels class
Serves a panel for as long as the handle is held.
The imperative half of AddDevbarPanel, the same way
UiService.addButton is the imperative half of AddDevbarButton. The
widget is the wrapper: it calls this in initState and removes in
dispose.
_panel = DevbarPanels.add(DatabasePanelSource(adapter)); // at login
_panel.remove(); // at logout
Which half to use is a question about the scope, not about taste. A panel belonging to a subtree — a signed-in shell, a checkout flow — should be declared where that subtree is, and the widget makes forgetting to remove it impossible. A panel belonging to a service — a session opened at login and closed at logout, an environment being switched — has no subtree to hang from, and reaching for the widget there means inventing a widget boundary for a lifetime that is not one. Inserting a widget above an existing subtree remounts it.
Needs no Devbar above it, and no BuildContext: a panel is served to
flutterware, not drawn in the overlay. Outside flutterware add hands back
an inert handle rather than null, so the call site never grows a ?.
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
-
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
Static Methods
-
add(
DevbarPanelSource source) → DevbarPanelHandle -
Starts serving
source. Put the handle where the thing it describes is closed — DevbarPanelHandle.remove belongs on the line next to theclose()it belongs to.