TrimStringsMiddleware class final

Trims surrounding whitespace from every string input, except the keys listed in except (Laravel's TrimStrings, which skips passwords).

Like every input transformer it applies to the input as the client sent it, not to fields a later Request.merge adds, and except names dotted paths (user.password).

Implemented types

Constructors

TrimStringsMiddleware({Set<String> except = defaultExcept})
Trims every string in the input, except the given keys (defaultExcept: the password fields, as in Laravel).
const

Properties

except → Set<String>
Keys left as sent, as dotted paths.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

handle(Request request, Next next) → Future<Response>
Handles request: return a response, or call next to continue.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

defaultExcept → const Set<String>
The keys Laravel's TrimStrings leaves as sent: current_password, password and password_confirmation. Extend it with {...TrimStringsMiddleware.defaultExcept, 'pin'}.