http_simple
library
Functions
apiCallForFile ({dynamic onResponse (Response )?, dynamic onTimeout ()?, dynamic onNoInternet ()?, required String tag , required HttpMethods apiMethod , required String url , Map <String , dynamic > ? body , Map <String , String > ? params , Map <String , AttachmentFile > ? keyAndfileMap , List <String > ? apiKeysForFiles , List <AttachmentFile > ? files , Duration timeoutDuration = defaultTimeoutDuration , bool needToPrintResponseLog = true })
→ Future <Response >
checkInternetConnection ()
→ Future <bool >
delete ({dynamic onResponse (Response )?, dynamic onTimeout ()?, dynamic onNoInternet ()?, required String tag , required String url , dynamic body , Map <String , String > ? params , Duration timeoutDuration = defaultTimeoutDuration })
→ Future <Response >
get ({dynamic onResponse (Response )?, dynamic onTimeout ()?, dynamic onNoInternet ()?, required String tag , required String url , Map <String , String > ? params , Duration timeoutDuration = defaultTimeoutDuration , bool needToPrintResponseLog = true })
→ Future <Response >
getFullURL (String url , Map <String , String > ? params )
→ Future <String >
getPrettyJSONString (dynamic res )
→ dynamic
parseAPIResponse <T > ({required Future <Response > response , required T fromJson (Map ), required String defaultErrorMessage , bool ? checkDefaultStatusCode , bool ? returnTrueForSuccess , dynamic onSuccess (T )?, dynamic onFailure (ErrorCodeAndMessage )? })
→ Future
This method will parse modelWithFromJson
or ErrorCodeAndMessage from response
.
response
is the API's returned data.
modelWithFromJson
is the class what you want back if the response
is success.
ErrorCodeAndMessage will be returned if the response
is fail.
Note: class modelWithFromJson
must have 'fromJson' method.
parseAPIResponseV2 <T , D > ({required Future <Response > call , List <String > ? successStatusCodes , required T fromJsonSuccess (Map ), required D fromJsonFailure (Map ), dynamic onSuccess (T )?, dynamic onFailure (D )? })
→ Future <({D? error , T? success } ) >
Default successStatusCodes
value is '200'
.
patch ({dynamic onResponse (Response )?, dynamic onTimeout ()?, dynamic onNoInternet ()?, required String tag , required String url , dynamic body , Map <String , String > ? params , Duration timeoutDuration = defaultTimeoutDuration })
→ Future <Response >
post ({dynamic onResponse (Response )?, dynamic onTimeout ()?, dynamic onNoInternet ()?, required String tag , required String url , Map <String , String > ? params , dynamic body , Duration timeoutDuration = defaultTimeoutDuration })
→ Future <Response >
printDebugLog ({required String tag , required String message , LogType ? logType })
→ void
printDebugLogFail ({required String tag , required String message })
→ void
printDebugLogSuccess ({required String tag , required String message })
→ void
put ({dynamic onResponse (Response )?, dynamic onTimeout ()?, dynamic onNoInternet ()?, required String tag , required String url , dynamic body , Map <String , String > ? params , Duration timeoutDuration = defaultTimeoutDuration })
→ Future <Response >