SmartApiRequest class

A fully-described API call, consumed by SmartApiClient.call.

You normally won't construct this directly — the get/post/put/ delete helpers on SmartApiClient build one for you — but it's public so you can compose your own request pipeline if needed.

Constructors

SmartApiRequest({required String endpoint, ApiMethod method = ApiMethod.get, dynamic body, List<SmartApiFile>? files, Map<String, dynamic>? queryParams, bool? autoDetectFiles, bool forceMultipart = false, bool forceRaw = false, bool showLoader = true, Map<String, dynamic>? extraHeaders})
Creates a request. See the field docs above for defaults.
const

Properties

autoDetectFiles → bool?
Per-request override for SmartApiConfig.autoDetectFiles.
final
body → dynamic
Request body. A plain Map is sent as JSON unless it contains a File/local file path (auto-detected) or files is also set, in which case it's sent as multipart form data.
final
endpoint → String
The endpoint to call. Either a path appended to SmartApiConfig.baseUrl (e.g. /api/login) or a full http(s):// URL.
final
extraHeaders → Map<String, dynamic>?
Extra headers merged on top of SmartApiConfig.headerBuilder's result for this request only.
final
files → List<SmartApiFile>?
Explicit file bindings. Passing this always forces multipart mode, regardless of autoDetectFiles.
final
forceMultipart → bool
Forces the body to be sent as multipart form data even if no file is detected.
final
forceRaw → bool
Forces the body to be sent as-is (raw), skipping file detection.
final
hashCode → int
The hash code for this object.
no setterinherited
method → ApiMethod
The HTTP verb to use. Defaults to ApiMethod.get.
final
queryParams → Map<String, dynamic>?
Query parameters appended to the URL, supported on every HTTP method (not just GET).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showLoader → bool
Whether SmartApiHooks.showLoader/hideLoader should fire for this request. Defaults to true.
final

Methods

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