get static method
Implementation
static Future<Map<String, dynamic>> get(String url, {Map<String, dynamic>? queryParameters, Duration? timeout}) async {
var headers = {'Content-Type': "application/json"};
var requestUrl = _mBaseUrl + url;
if (getSessionToken() != null) {
headers["Authorization"] = "Bearer ${getSessionToken()}";
}
if (getAppId() != null) {
headers["app-id"] = getAppId()!;
}
try {
final effectiveTimeout = timeout ?? const Duration(seconds: 15);
final dio = Dio(BaseOptions(connectTimeout: const Duration(seconds: 10), receiveTimeout: effectiveTimeout));
final response = await dio.get(requestUrl, queryParameters: queryParameters, options: Options(headers: headers));
if (response.statusCode! >= 200 && response.statusCode! < 300) {
return response.data;
}
throw HttpUtil.makeTPException(response);
} on DioException catch (e) {
if (e.response != null) {
throw HttpUtil.makeTPException(e.response);
}
throw TPException()..setCode(-1)..setMessage(e.message ?? e.type.name);
} catch(e){
rethrow;
}
}