getDio method

Dio getDio({
  1. bool isDebug = false,
  2. int maxWidth = 128,
  3. bool requestBody = true,
  4. bool requestHeader = true,
  5. bool request = true,
  6. bool error = true,
  7. bool responseBody = true,
  8. String cert = "",
})

if you want to return debug mode of dio which will include prettyfy display of the request sent via http or receive else it will not print the request use strictly on debugging mode

Implementation

Dio getDio(
    {bool isDebug = false,
    int maxWidth = 128,
    bool requestBody = true,
    bool requestHeader = true,
    bool request = true,
    bool error = true,
    bool responseBody = true,
    String cert = ""}) {
  Dio dio = Dio();
  dio.options.contentType = Headers.jsonContentType;
  if (isDebug) {
    dio.interceptors.add(
      PrettyDioLogger(
          requestBody: requestBody,
          requestHeader: requestHeader,
          request: request,
          maxWidth: maxWidth,
          error: error,
          responseBody: responseBody),
    );
    return dio;
  }
  return Dio();
}