refactor(http)!: fix cascade dart good practices + docs

This commit is contained in:
2023-04-13 23:29:27 +02:00
parent 216a6c2aae
commit 07c2f4aeff
33 changed files with 303 additions and 974 deletions
@@ -1,4 +1,3 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
// Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details.
//
@@ -20,15 +19,12 @@ import 'package:wyatt_http_client/src/models/middleware_request.dart';
import 'package:wyatt_http_client/src/models/middleware_response.dart';
import 'package:wyatt_http_client/src/pipeline.dart';
/// {@template middleware_context}
/// A class that contains the context of the middleware.
/// {@endtemplate}
class MiddlewareContext {
Pipeline pipeline;
MiddlewareClient client;
MiddlewareRequest? originalRequest;
MiddlewareRequest? lastRequest;
MiddlewareResponse? originalResponse;
MiddlewareResponse? lastResponse;
MiddlewareContext({
/// {@macro middleware_context}
const MiddlewareContext({
required this.pipeline,
required this.client,
this.originalRequest,
@@ -37,6 +33,26 @@ class MiddlewareContext {
this.lastResponse,
});
/// The pipeline that the middleware is in.
final Pipeline pipeline;
/// The client that the middleware is in.
final MiddlewareClient client;
/// The original request that the middleware is in.
final MiddlewareRequest? originalRequest;
/// The last request that the middleware is in.
final MiddlewareRequest? lastRequest;
/// The original response that the middleware is in.
final MiddlewareResponse? originalResponse;
/// The last response that the middleware is in.
final MiddlewareResponse? lastResponse;
/// Create a copy of this [MiddlewareContext] with the given fields replaced
/// with the new values.
MiddlewareContext copyWith({
Pipeline? pipeline,
MiddlewareClient? client,