checkPreCondition method
bool
checkPreCondition(
- S step
)
Implementation
bool checkPreCondition(S step) {
__.in_('checkPreCondition');
try {
checkInitialized('BaseFlow');
// Get transitions map from the concrete flow
final transitions = getTransitionsForFlow();
// If no transitions map, return true (no precondition)
if (transitions == null) {
return true;
}
// Check if there's a precondition for this step
if (transitions.containsKey(step)) {
final transition = transitions[step];
if (transition?.preCondition != null) {
final result = transition!.preCondition!(flowState);
__.info('Precondition for step ${step.name}: $result');
return result;
}
}
// No precondition defined for this step
return true;
} catch (e, stackTrace) {
__.severe('Error checking precondition', e, stackTrace);
return false; // Fail closed
} finally {
__.out_('checkPreCondition');
}
}