isAllowedOrigin method

bool isAllowedOrigin (
  1. String origin
)

Implementation

bool isAllowedOrigin(String origin) {
  if (_allowAllOrigins) return true;
  if (_allowedOrigins != null) {
    for (int i = 0; i < _allowedOrigins.length; i++) {
      if (origin == _allowedOrigins[i].toLowerCase()) {
        return true;
      }
    }
  }
  if (_allowedWildcardOrigins != null) {
    for (int i = 0; i < _allowedWildcardOrigins.length; i++) {
      var o = _allowedWildcardOrigins[i];
      if (origin.startsWith(o[0]) && origin.endsWith(o[1])) {
        return true;
      }
    }
  }
  return false;
}