getNextStages method

Set<String> getNextStages(
  1. List<AuthenticationFlow> flows,
  2. List<String> completed
)

Implementation

Set<String> getNextStages(
    List<AuthenticationFlow> flows, List<String> completed) {
  final nextStages = <String>{};
  for (final flow in flows) {
    final stages = flow.stages;
    final nextStage = stages[completed.length];
    var stagesValid = true;
    for (var i = 0; i < completed.length; i++) {
      if (stages[i] != completed[i]) {
        stagesValid = false;
        break;
      }
    }
    if (stagesValid) {
      nextStages.add(nextStage);
    }
  }
  return nextStages;
}