ConditionConfiguration class abstract
Base class for all condition configurations.
Condition configurations define the evaluation logic for a condition. Each type of configuration implements this class and provides its own execution logic.
Common configuration types include:
- User role checks
- Feature flag checks
- Time-based conditions
- State-based conditions
Example implementation:
@JsonSerializable()
class UserRoleCondition extends ConditionConfiguration {
static const schemaName = 'condition.user_role';
final List<String> allowedRoles;
UserRoleCondition({
required this.allowedRoles,
super.title,
}) : super(schemaType: schemaName);
@override
Future<String?> execute(BuildContext context) async {
final user = vyuh.auth.currentUser;
if (user == null) {
return 'Not authenticated';
}
if (!allowedRoles.contains(user.role)) {
return 'Insufficient permissions';
}
return null; // Condition passed
}
}
Constructors
- ConditionConfiguration.new({required String schemaType, String? title})
- Creates a new condition configuration.
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.
final
- title → String?
-
Optional title for this configuration.
final
Methods
-
execute(
BuildContext context) → Future< String?> - Evaluates this condition configuration.
-
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