FlodValidateInterceptor class
Dio middleware that validates JSON response bodies against a Flod schema.
On success, replaces Response.data with the typed, validated output. On failure, rejects with DioException wrapping ValidationException.
- Inheritance
-
- Object
- Interceptor
- FlodValidateInterceptor
Constructors
- FlodValidateInterceptor({required Validator schema, JsonGuard? guard, dynamic extractData(Response response)?})
Properties
- extractData → dynamic Function(Response response)?
-
Optional extractor when the payload lives under a nested key
(e.g.
(r) => r.data['data']).final - guard → JsonGuard?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schema → Validator
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onError(
DioException err, ErrorInterceptorHandler handler) → void -
Called when an exception was occurred during the request.
inherited
-
onRequest(
RequestOptions options, RequestInterceptorHandler handler) → void -
Called when the request is about to be sent.
inherited
-
onResponse(
Response response, ResponseInterceptorHandler handler) → void -
Called when the response is about to be resolved.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
validatePayload<
T> ({required dynamic raw, required Validator< T> schema, JsonGuard? guard}) → ParseResult<T> - Validates a raw response payload — usable without Dio for unit tests.