postBytes method

Future<List<int>> postBytes(
  1. String endpoint, {
  2. required Map<String, dynamic> data,
})

Implementation

Future<List<int>> postBytes(
  String endpoint, {
  required Map<String, dynamic> data,
}) async {
  try {
    final response = await _dio.post<List<int>>(
      endpoint,
      data: jsonEncode(data),
      options: Options(
        responseType: ResponseType.bytes,
      ),
    );

    return response.data!;
  } on DioException catch (e) {
    throw Exception(_handleError(e));
  }
}