Knobs class

The controls an entry declares by asking for them while it builds.

A knob is a read with a default, not a declaration. Nothing registers one: context.knobs.bool('Edit mode', false) is the declaration, and the same call answers with false where nothing is hosting — a real app, a test, Flutter's own previewer. That is what makes it safe to leave in a widget that ships.

This base class is that unhosted answer. EditableKnobs is the hosted one.

Constructors

Knobs()

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

bool(String name, bool defaultValue) → bool
button(String name, String text, VoidCallback onTap) → void
dateTime(String name, DateTime defaultValue, {bool dateOnly = false}) → DateTime
double(String name, double defaultValue, {double? min, double? max}) → double
int(String name, int defaultValue, {int? min, int? max}) → int
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
nullableDateTime(String name, DateTime? defaultValue, {bool dateOnly = false}) → DateTime?
num(String name, num defaultValue, {num? min, num? max}) → num
picker<T>(String name, Map<String, T> values, T defaultValue, {Color swatch(T value)?, IconData icon(T value)?, PickerStyle style = PickerStyle.dropdown}) → T
A choice between named options, label to value.
string(String name, String defaultValue) → String
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

unanswered → Knobs
What a knob answers with when no KnobsProvider is above it.
final