Open satishs22 opened 5 months ago
If you added a TalkerDioLogger to dio interceptor, check to passed a talker instance in the 'talker' parameter.
static talkerInit() {
final talker = TalkerFlutter.init(
settings: TalkerSettings(
colors: {
TalkerLogType.verbose: AnsiPen()..yellow(),
},
),
);
DI.registerSingleton<Talker>(talker);
talker.verbose('Talker initialization completed');
}
post(
String path, {
dynamic data,
Map<String, dynamic>? queryParameters,
Options? options,
bool isRaw = false,
bool isShowLoading = false,
String? loadingText = "Loading",
VFMAnimationType? loadingAnimation = VFMAnimationType.circular,
String? lottieLoadingAsset = "",
bool isShowResultDialog = false,
String? message,
bool printResponseData = false,
bool printResponseHeaders = false,
bool printRequestData = true,
bool printRequestHeaders = true,
}) async {
dio.interceptors.clear();
dio.interceptors.add(customInterceptors(
isShowLoading, loadingText!, loadingAnimation!, lottieLoadingAsset!));
dio.interceptors.add(customTalker(
printResponseHeaders: printRequestHeaders,
printRequestHeaders: printRequestHeaders,
printRequestData: printRequestData,
printResponseData: printResponseData,
));
dio.options.baseUrl = isRaw ? path : baseUrl;
Options requestOptions = options ?? Options();
requestOptions.headers = requestOptions.headers ?? {};
Map<String, dynamic>? authorization = getAuthorizationHeader();
if (authorization != null) {
requestOptions.headers!.addAll(authorization);
}
var response = await dio.post(
path,
data: data,
queryParameters: queryParameters,
options: requestOptions,
cancelToken: cancelToken,
);
dio.options.baseUrl = baseUrl;
return response.data;
}
TalkerDioLogger customTalker({
bool printResponseData = false,
bool printResponseHeaders = false,
bool printRequestData = true,
bool printRequestHeaders = true,
}) =>
TalkerDioLogger(
talker: DI.get<Talker>(),
settings: TalkerDioLoggerSettings(
printResponseData: printResponseData,
printResponseHeaders: printResponseHeaders,
printRequestData: printRequestData,
printRequestHeaders: printRequestHeaders,
),
);
as you can see I added a talker instance, this issue only happens when form data is being pass, it works if normal json data is being pass @silvershort
Describe the bug The log is not printing header or data when form data is being passed.
To Reproduce Steps to reproduce the behavior:
Expected behavior Suppose be printing header/form data
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.