ConditionalAction class
An action configuration that executes different actions based on a condition.
Features:
- Dynamic action selection based on conditions
- Multiple case handling with default fallback
- Support for any action type in cases
- Asynchronous condition evaluation
Example:
final action = ConditionalAction(
condition: Condition(
configuration: ScreenSize(),
),
cases: [
ActionCase(
value: 'mobile',
action: Action(
configurations: [
NavigationAction(url: '/mobile-view'),
],
),
),
ActionCase(
value: 'desktop',
action: Action(
configurations: [
NavigationAction(url: '/desktop-view'),
],
),
),
],
defaultCase: 'mobile',
);
- Inheritance
-
- Object
- ActionConfiguration
- ConditionalAction
- Annotations
-
- @JsonSerializable()
Constructors
-
ConditionalAction.new({List<
ActionCase> ? cases, Condition? condition, String? defaultCase, bool? isAwaited}) -
ConditionalAction.fromJson(Map<
String, dynamic> json) -
factory
Properties
-
cases
→ List<
ActionCase> ? -
final
- condition → Condition?
-
final
- defaultCase → String?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAwaited → bool?
-
Whether to await this configuration's execution.
finalinherited
- 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, {Map< String, dynamic> ? arguments}) → Future<void> -
Executes this 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<
ConditionalAction> -
final
Constants
- schemaName → const String