runMiddleware method

Future<GetNavConfig?> runMiddleware(
  1. GetNavConfig config
)

Implementation

Future<GetNavConfig?> runMiddleware(GetNavConfig config) async {
  final middlewares = config.currentTreeBranch.last.middlewares;
  if (middlewares == null) {
    return config;
  }
  var iterator = config;
  for (var item in middlewares) {
    var redirectRes = await item.redirectDelegate(iterator);
    if (redirectRes == null) return null;
    iterator = redirectRes;
  }
  return iterator;
}