postRaw<T> method

Future<(int?, String?, T)> postRaw<T>(
  1. String endpoint, {
  2. required dynamic data,
  3. required T fromJson(
    1. dynamic
    ),
})

Implementation

Future<(int? statusCode, String? message, T data)> postRaw<T>(
  String endpoint, {
  required dynamic data,
  required T Function(dynamic) fromJson,
}) async {
  try {
    final response = await _dio.post(
      endpoint,
      data: data,
    );

    return (
      response.statusCode,
      response.statusMessage,
      fromJson(response.data),
    );
  } on DioException catch (e) {
    throw Exception(_handleError(e));
  }
}