Skip to content

@bool

Declares a named boolean value resource.

Declaration

<resources xmlns="https://xwidget.dev/values">
    <bool name="showWelcome">true</bool>
    <bool name="debugMode">false</bool>
    <bool name="enableAnalytics">true</bool>
</resources>
Attribute Description Required
name Unique key for the value Yes

Valid values are true and false.

Fragment Usage

Reference with the @bool/ directive:

<fragment name="welcome_banner" visible="@bool/showWelcome"/>

Dart Usage

final showWelcome = Resources.instance.getBool("showWelcome");

Throws an exception if the resource name is not found.

See Also