CurrentThemeMode class final

A condition configuration that evaluates the current theme mode.

Features:

  • Theme mode detection (light/dark)
  • Integration with ThemeService
  • Reactive theme changes
  • Asynchronous evaluation

Example:

// In a conditional content
final conditional = Conditional(
  condition: Condition(
    configuration: CurrentThemeMode(),
  ),
  cases: [
    CaseItem(
      value: 'light',
      item: LightThemeContent(),
    ),
    CaseItem(
      value: 'dark',
      item: DarkThemeContent(),
    ),
  ],
  defaultCase: 'light',
);

// In a conditional action
final action = ConditionalAction(
  condition: Condition(
    configuration: CurrentThemeMode(),
  ),
  cases: [
    ActionCase(
      value: 'light',
      action: NavigationAction(url: '/light-theme'),
    ),
    ActionCase(
      value: 'dark',
      action: NavigationAction(url: '/dark-theme'),
    ),
  ],
  defaultCase: 'light',
);

The condition returns:

  • 'light' for light theme mode
  • 'dark' for dark theme mode
  • 'system' for system theme mode
Inheritance
  • Object
  • ConditionConfiguration
  • CurrentThemeMode

Constructors

CurrentThemeMode.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
schemaType String
The schema type of this configuration.
finalinherited
title String?
Optional title for this configuration.
finalinherited

Methods

execute(BuildContext context) Future<String?>
Evaluates this condition configuration.
override
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 Properties

typeDescriptor → TypeDescriptor<CurrentThemeMode>
final

Constants

schemaName → const String