ToggleSheetDelegateValue<T> class

A delegate that always returns a constant, static value.

This is useful when the value controlling sheet behavior (e.g., barrierColor) is fixed and does not need to respond to dynamic state or controller input.

Typically used like this:

barrierColorDelegate: ToggleSheetDelegate.value(Colors.black.withOpacity(0.5))

⚠️ It is recommended to initialize this delegate as a final field (e.g., in your State class), not directly inside the build() method, to avoid unnecessary widget rebuilds.

Inheritance

Constructors

ToggleSheetDelegateValue({required T value})
Creates a ToggleSheetDelegateValue with a constant value.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T
The constant value returned by the delegate.
final

Methods

getStaticValue() → T?
We need this method to get the value of the delegate if it is a static value. We want to avoid calling the function every time we need the value and we can use this method in init() to get the value of the delegate and store it in a variable.
inherited
getValue<K>(ToggleSheetController controller) → T?
inherited
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