HeaderRule class

Matches on a request header.

With equals, the header must equal a value; with contains, it must contain a substring; otherwise the header must merely be present. Comparisons are case-insensitive unless caseSensitive is set.

Inheritance

Constructors

HeaderRule(String name, {String? equals, String? contains, bool caseSensitive = false})
Creates a header rule. Provide equals or contains to constrain the value; provide neither to match on mere presence.
const

Properties

caseSensitive bool
Whether value comparison is case-sensitive.
final
contains String?
The substring required, if any.
final
equals String?
The exact value required, if any.
final
hashCode int
The hash code for this object.
no setterinherited
name String
The header name (compared case-insensitively).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
specificity int
A relative measure of how specific this rule is, used as a tie-breaker among matching routes of equal priority. Higher is more specific.
no setteroverride

Methods

and(RouteRule other) RouteRule
A rule matching when both this and other match.
inherited
matches(RouteContext context) bool
Whether this rule matches context.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
not() RouteRule
A rule matching when this rule does not match.
inherited
or(RouteRule other) RouteRule
A rule matching when either this or other matches.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator &(RouteRule other) RouteRule
Operator form of and.
inherited
operator ==(Object other) bool
The equality operator.
inherited
operator |(RouteRule other) RouteRule
Operator form of or.
inherited
operator ~() RouteRule
Operator form of not.
inherited