before method

  1. @override
FutureOr<void> before(
  1. RouteBase route
)
override

Implementation

@override
FutureOr<void> before(RouteBase route) {
    final authInfo = getAuthInfo(route, "apiKey");
    for (var info in authInfo) {
        final authName = info["name"];
        final authKeyName = info["keyName"];
        final authWhere = info["where"];
        final apiKey = apiKeys[authName];
        if(apiKey != null) {
            if(authWhere == 'query'){
                route.query(authKeyName, apiKey);
            }
        else {
                route.header(authKeyName, apiKey);
            }
            break;
        }
    }
    return super.before(route);
}