FeatureFlagCondition class final

A condition configuration that evaluates feature flags for dynamic behavior.

Features:

  • Multiple data type support (string, number, boolean, JSON)
  • Integration with feature flag service
  • Asynchronous evaluation
  • Type-safe value handling

Example:

// String flag
final condition = FeatureFlagCondition(
  flagName: 'app.theme',
  dataType: FlagDataType.string,
);

// Boolean flag
final condition = FeatureFlagCondition(
  flagName: 'feature.enabled',
  dataType: FlagDataType.boolean,
);

// In a conditional content
final conditional = Conditional(
  condition: Condition(
    configuration: FeatureFlagCondition(
      flagName: 'feature.enabled',
      dataType: FlagDataType.boolean,
    ),
  ),
  cases: [
    CaseItem(
      value: 'true',
      item: FeatureContent(),
    ),
  ],
  defaultCase: 'false',
);

The condition:

  • Returns null if flag name is empty
  • Converts all values to strings for case matching
  • Handles JSON values by encoding them
Inheritance
  • Object
  • ConditionConfiguration
  • FeatureFlagCondition
Annotations
  • @JsonSerializable()

Constructors

FeatureFlagCondition.new({String flagName = '', FlagDataType dataType = FlagDataType.string})
FeatureFlagCondition.fromJson(Map<String, dynamic> json)
factory

Properties

dataType FlagDataType
final
flagName String
final
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<FeatureFlagCondition>
final

Constants

schemaName → const String