SmartApiClient class
A single, app-wide Dio wrapper that turns every API call into one line.
Configure it once via SmartApiConfig.init and wire up
SmartApiHooks, then call get, post, put or delete — file
detection, multipart conversion, loader/message hooks, session-expiry
and no-internet retry are all handled centrally.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call<
T> (SmartApiRequest request, {T fromJson(dynamic json)?}) → Future< SmartApiResponse< T> > -
Executes a fully-described
requestand returns a typed SmartApiResponse. This is what get, post, put and delete build a SmartApiRequest and delegate to — call it directly if you need full control (custom ApiMethod, forced multipart/raw, etc.). -
delete<
T> (String endpoint, {dynamic body, Map< String, dynamic> ? queryParams, T fromJson(dynamic)?, bool showLoader = true}) → Future<SmartApiResponse< T> > -
Sends a DELETE request to
endpoint, optionally with a JSONbodyand/orqueryParams. -
get<
T> (String endpoint, {Map< String, dynamic> ? params, T fromJson(dynamic)?, bool showLoader = true}) → Future<SmartApiResponse< T> > -
Sends a GET request to
endpoint, withparamsappended as query parameters. PassfromJsonto get back a typed SmartApiResponse. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
post<
T> (String endpoint, {dynamic body, List< SmartApiFile> ? files, Map<String, dynamic> ? queryParams, bool? autoDetectFiles, bool forceRaw = false, T fromJson(dynamic)?, bool showLoader = true}) → Future<SmartApiResponse< T> > -
Sends a POST request to
endpoint. Ifbodycontains aFileor local file path (andautoDetectFilesisn't disabled), orfilesis provided, the request is sent as multipart form data — otherwise it's sent as raw JSON. -
put<
T> (String endpoint, {dynamic body, List< SmartApiFile> ? files, Map<String, dynamic> ? queryParams, bool? autoDetectFiles, bool forceRaw = false, T fromJson(dynamic)?, bool showLoader = true}) → Future<SmartApiResponse< T> > -
Sends a PUT request to
endpoint. Same auto raw/multipart detection as post applies tobodyandfiles, includingforceRaw. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → SmartApiClient
-
The shared, lazily-created singleton instance.
final