from method

bool from(
  1. APIRequestMethod? requestMethod,
  2. Object? provider
)

Adds routes from provider for the request requestMethod.

provider can be one of the types below:

Implementation

bool from(APIRequestMethod? requestMethod, Object? provider) {
  if (provider == null) return false;

  if (provider is MethodReflection) {
    return apiMethod(provider, requestMethod);
  } else if (provider is Iterable<MethodReflection>) {
    return apiMethods(provider, requestMethod);
  } else if (provider is ClassReflection) {
    return apiReflection(provider, requestMethod);
  } else if (provider is Iterable) {
    var addedAny = false;
    for (var e in provider) {
      var added = from(e, requestMethod);
      addedAny |= added;
    }
    return addedAny;
  }

  return false;
}