@ -124,7 +124,7 @@ class BaseAppClient {
/ / body [ ' IdentificationNo ' ] = 2076117163 ;
/ / body [ ' IdentificationNo ' ] = 2076117163 ;
/ / body [ ' MobileNo ' ] = " 966503109207 " ;
/ / body [ ' MobileNo ' ] = " 966503109207 " ;
/ / body [ ' PatientID ' ] = 2380476 ; / / 3844083
/ / body [ ' PatientID ' ] = 3114694 ; / / 3844083
/ / body [ ' TokenID ' ] = " @dm!n " ;
/ / body [ ' TokenID ' ] = " @dm!n " ;
/ / Patient ID: 3027574
/ / Patient ID: 3027574
@ -140,7 +140,7 @@ class BaseAppClient {
if ( await Utils . checkConnection ( ) ) {
if ( await Utils . checkConnection ( ) ) {
final response = await http . post ( Uri . parse ( url . trim ( ) ) , body: json . encode ( body ) , headers: headers ) ;
final response = await http . post ( Uri . parse ( url . trim ( ) ) , body: json . encode ( body ) , headers: headers ) ;
final int statusCode = response . statusCode ;
final int statusCode = response . statusCode ;
print ( " statusCode : $ statusCode " ) ;
/ / print ( " statusCode : $ statusCode " ) ;
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
onFailure ( ' Error While Fetching data ' , statusCode ) ;
onFailure ( ' Error While Fetching data ' , statusCode ) ;
} else {
} else {
@ -307,14 +307,14 @@ class BaseAppClient {
}
}
}
}
print ( " URL : $ url " ) ;
/ / print ( " URL : $ url " ) ;
print ( " Body : ${ json . encode ( body ) } " ) ;
/ / print ( " Body : ${ json . encode ( body ) } " ) ;
print ( " Headers : ${ json . encode ( headers ) } " ) ;
/ / print ( " Headers : ${ json . encode ( headers ) } " ) ;
if ( await Utils . checkConnection ( ) ) {
if ( await Utils . checkConnection ( ) ) {
final response = await http . post ( Uri . parse ( url . trim ( ) ) , body: json . encode ( body ) , headers: headers ) ;
final response = await http . post ( Uri . parse ( url . trim ( ) ) , body: json . encode ( body ) , headers: headers ) ;
final int statusCode = response . statusCode ;
final int statusCode = response . statusCode ;
print ( " statusCode : $ statusCode " ) ;
/ / print ( " statusCode : $ statusCode " ) ;
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
onFailure ( ' Error While Fetching data ' , statusCode ) ;
onFailure ( ' Error While Fetching data ' , statusCode ) ;
} else {
} else {
@ -409,7 +409,7 @@ class BaseAppClient {
url + = ' ? ' + queryString ;
url + = ' ? ' + queryString ;
}
}
print ( " URL : $ url " ) ;
/ / print ( " URL : $ url " ) ;
if ( await Utils . checkConnection ( ) ) {
if ( await Utils . checkConnection ( ) ) {
final response = await http . get (
final response = await http . get (
@ -417,7 +417,7 @@ class BaseAppClient {
headers: { ' Content-Type ' : ' application/json ' , ' Accept ' : ' application/json ' } ,
headers: { ' Content-Type ' : ' application/json ' , ' Accept ' : ' application/json ' } ,
) ;
) ;
final int statusCode = response . statusCode ;
final int statusCode = response . statusCode ;
print ( " statusCode : $ statusCode " ) ;
/ / print ( " statusCode : $ statusCode " ) ;
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
onFailure ( ' Error While Fetching data ' , statusCode ) ;
onFailure ( ' Error While Fetching data ' , statusCode ) ;
@ -465,7 +465,7 @@ class BaseAppClient {
' Host ' : " mdlaboratories.com " ,
' Host ' : " mdlaboratories.com " ,
} ) ;
} ) ;
final int statusCode = response . statusCode ;
final int statusCode = response . statusCode ;
print ( " statusCode : $ statusCode " ) ;
/ / print ( " statusCode : $ statusCode " ) ;
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
if ( statusCode = = 401 ) {
if ( statusCode = = 401 ) {
@ -473,7 +473,7 @@ class BaseAppClient {
Navigator . of ( AppGlobal . context ) . pushNamed ( HOME ) ;
Navigator . of ( AppGlobal . context ) . pushNamed ( HOME ) ;
} else {
} else {
var bodyUtf = json . decode ( utf8 . decode ( response . bodyBytes ) ) ;
var bodyUtf = json . decode ( utf8 . decode ( response . bodyBytes ) ) ;
print ( bodyUtf ) ;
/ / print ( bodyUtf ) ;
onFailure ( bodyUtf [ ' error ' ] [ ' ErrorEndUserMsg ' ] , statusCode ) ;
onFailure ( bodyUtf [ ' error ' ] [ ' ErrorEndUserMsg ' ] , statusCode ) ;
}
}
} else {
} else {
@ -494,8 +494,8 @@ class BaseAppClient {
Function ( String error , int statusCode ) onFailure ,
Function ( String error , int statusCode ) onFailure ,
} ) async {
} ) async {
String url = fullUrl ;
String url = fullUrl ;
print ( " URL Query String: $ url " ) ;
/ / print ( " URL Query String: $ url " ) ;
print ( " body: $ body " ) ;
/ / print ( " body: $ body " ) ;
if ( await Utils . checkConnection ( ) ) {
if ( await Utils . checkConnection ( ) ) {
headers . addAll ( { ' Content-Type ' : ' application/json ' , ' Accept ' : ' application/json ' } ) ;
headers . addAll ( { ' Content-Type ' : ' application/json ' , ' Accept ' : ' application/json ' } ) ;
@ -505,10 +505,10 @@ class BaseAppClient {
headers: headers ,
headers: headers ,
) ;
) ;
final int statusCode = response . statusCode ;
final int statusCode = response . statusCode ;
print ( " statusCode : $ statusCode " ) ;
/ / print ( " statusCode : $ statusCode " ) ;
if ( await handleUnauthorized ( statusCode , forUrl: fullUrl ) ) simplePost ( fullUrl , onFailure: onFailure , onSuccess: onSuccess , body: body , headers: headers ) ;
if ( await handleUnauthorized ( statusCode , forUrl: fullUrl ) ) simplePost ( fullUrl , onFailure: onFailure , onSuccess: onSuccess , body: body , headers: headers ) ;
print ( response . body . toString ( ) ) ;
/ / print ( response . body . toString ( ) ) ;
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
onFailure ( ' Error While Fetching data ' , statusCode ) ;
onFailure ( ' Error While Fetching data ' , statusCode ) ;
@ -529,7 +529,7 @@ class BaseAppClient {
if ( haveParams ) {
if ( haveParams ) {
String queryString = Uri ( queryParameters: queryParams ) . query ;
String queryString = Uri ( queryParameters: queryParams ) . query ;
url + = ' ? ' + queryString ;
url + = ' ? ' + queryString ;
print ( " URL Query String: $ url " ) ;
/ / print ( " URL Query String: $ url " ) ;
}
}
if ( await Utils . checkConnection ( ) ) {
if ( await Utils . checkConnection ( ) ) {
@ -540,7 +540,7 @@ class BaseAppClient {
) ;
) ;
final int statusCode = response . statusCode ;
final int statusCode = response . statusCode ;
print ( " statusCode : $ statusCode " ) ;
/ / print ( " statusCode : $ statusCode " ) ;
if ( await handleUnauthorized ( statusCode , forUrl: fullUrl ) ) simpleGet ( fullUrl , onFailure: onFailure , onSuccess: onSuccess , headers: headers , queryParams: queryParams ) ;
if ( await handleUnauthorized ( statusCode , forUrl: fullUrl ) ) simpleGet ( fullUrl , onFailure: onFailure , onSuccess: onSuccess , headers: headers , queryParams: queryParams ) ;
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
@ -555,7 +555,7 @@ class BaseAppClient {
simplePut ( String fullUrl , { Map < String , dynamic > body , Map < String , String > headers , Function ( dynamic response , int statusCode ) onSuccess , Function ( String error , int statusCode ) onFailure } ) async {
simplePut ( String fullUrl , { Map < String , dynamic > body , Map < String , String > headers , Function ( dynamic response , int statusCode ) onSuccess , Function ( String error , int statusCode ) onFailure } ) async {
String url = fullUrl ;
String url = fullUrl ;
print ( " URL Query String: $ url " ) ;
/ / print ( " URL Query String: $ url " ) ;
if ( await Utils . checkConnection ( ) ) {
if ( await Utils . checkConnection ( ) ) {
headers . addAll ( { ' Content-Type ' : ' application/json ' , ' Accept ' : ' application/json ' } ) ;
headers . addAll ( { ' Content-Type ' : ' application/json ' , ' Accept ' : ' application/json ' } ) ;
@ -566,7 +566,7 @@ class BaseAppClient {
) ;
) ;
final int statusCode = response . statusCode ;
final int statusCode = response . statusCode ;
print ( " statusCode : $ statusCode " ) ;
/ / print ( " statusCode : $ statusCode " ) ;
if ( await handleUnauthorized ( statusCode , forUrl: fullUrl ) ) simplePut ( fullUrl , onFailure: onFailure , onSuccess: onSuccess , headers: headers , body: body ) ;
if ( await handleUnauthorized ( statusCode , forUrl: fullUrl ) ) simplePut ( fullUrl , onFailure: onFailure , onSuccess: onSuccess , headers: headers , body: body ) ;
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
@ -582,13 +582,13 @@ class BaseAppClient {
simpleDelete ( String fullUrl ,
simpleDelete ( String fullUrl ,
{ Function ( dynamic response , int statusCode ) onSuccess , Function ( String error , int statusCode ) onFailure , Map < String , String > queryParams , Map < String , String > headers } ) async {
{ Function ( dynamic response , int statusCode ) onSuccess , Function ( String error , int statusCode ) onFailure , Map < String , String > queryParams , Map < String , String > headers } ) async {
String url = fullUrl ;
String url = fullUrl ;
print ( " URL Query String: $ url " ) ;
/ / print ( " URL Query String: $ url " ) ;
var haveParams = ( queryParams ! = null ) ;
var haveParams = ( queryParams ! = null ) ;
if ( haveParams ) {
if ( haveParams ) {
String queryString = Uri ( queryParameters: queryParams ) . query ;
String queryString = Uri ( queryParameters: queryParams ) . query ;
url + = ' ? ' + queryString ;
url + = ' ? ' + queryString ;
print ( " URL Query String: $ url " ) ;
/ / print ( " URL Query String: $ url " ) ;
}
}
if ( await Utils . checkConnection ( ) ) {
if ( await Utils . checkConnection ( ) ) {
@ -599,7 +599,7 @@ class BaseAppClient {
) ;
) ;
final int statusCode = response . statusCode ;
final int statusCode = response . statusCode ;
print ( " statusCode : $ statusCode " ) ;
/ / print ( " statusCode : $ statusCode " ) ;
if ( await handleUnauthorized ( statusCode , forUrl: fullUrl ) ) simpleDelete ( fullUrl , onFailure: onFailure , onSuccess: onSuccess , queryParams: queryParams , headers: headers ) ;
if ( await handleUnauthorized ( statusCode , forUrl: fullUrl ) ) simpleDelete ( fullUrl , onFailure: onFailure , onSuccess: onSuccess , queryParams: queryParams , headers: headers ) ;
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
@ -729,8 +729,8 @@ class BaseAppClient {
}
}
}
}
print ( " URL : $ url " ) ;
/ / print ( " URL : $ url " ) ;
print ( " Body : ${ json . encode ( body ) } " ) ;
/ / print ( " Body : ${ json . encode ( body ) } " ) ;
var ss = json . encode ( body ) ;
var ss = json . encode ( body ) ;
if ( await Utils . checkConnection ( ) ) {
if ( await Utils . checkConnection ( ) ) {
@ -746,7 +746,7 @@ class BaseAppClient {
' Username ' : user ! = null ? user [ ' PatientID ' ] . toString ( ) : " " ,
' Username ' : user ! = null ? user [ ' PatientID ' ] . toString ( ) : " " ,
} ) ;
} ) ;
final int statusCode = response . statusCode ;
final int statusCode = response . statusCode ;
print ( " statusCode : $ statusCode " ) ;
/ / print ( " statusCode : $ statusCode " ) ;
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
if ( statusCode < 200 | | statusCode > = 400 | | json = = null ) {
var parsed = json . decode ( utf8 . decode ( response . bodyBytes ) ) ;
var parsed = json . decode ( utf8 . decode ( response . bodyBytes ) ) ;
onFailure ( parsed [ ' error ' ] [ ' ErrorEndUserMsgN ' ] ? ? ' Error While Fetching data ' , statusCode ) ;
onFailure ( parsed [ ' error ' ] [ ' ErrorEndUserMsgN ' ] ? ? ' Error While Fetching data ' , statusCode ) ;