Request constructor

Request({
  1. required String? endpoint,
  2. HttpMethod method = HttpMethod.get,
  3. Map<String, String>? headers,
  4. Map<String, dynamic>? queryParameters,
  5. OnProgress? onProgress,
  6. dynamic body,
  7. Encoding? encoding,
  8. DateTime? createdAt,
  9. ObjectId? id,
  10. CacheKey? key,
})

Implementation

Request({
  required this.endpoint,
  this.method = HttpMethod.get,
  Map<String, String>? headers,
  Map<String, dynamic>? queryParameters,
  this.onProgress,
  this.body,
  this.encoding,
  DateTime? createdAt,
  ObjectId? id,
  this.key,
})  : createdAt = createdAt ?? DateTime.now(),
      id = id ?? ObjectId() {
  if (headers != null) this.headers.addAll(headers);
  if (queryParameters != null) this.queryParameters.addAll(queryParameters);
}