get<T> static method
Implementation
static Future<ApiResponse<T>> get<T>(String endpoint,
{Map<String, String>? args,
List<MultipartFile>? files,
String? method,
String? dataPath,
String? errorPath}) async {
ApiResponse<T> data;
try {
data = ApiResponse<T>(
await _post(endpoint, body: args, files: files, method: method),
dataPath: dataPath,
errorPath: errorPath);
} catch (e) {
log(e.toString(), error: e);
var obj = {"error": e.toString()};
data = ApiResponse<T>(obj, errorPath: "error");
}
if (data.isSuccess) {
return data;
} else {
log(data.error!);
onError?.call(baseUri.toString() + endpoint, data.error);
return Future.error(data.error!);
}
}