syedmurtaza108 / chucker-flutter

An HTTP requests inspector inspired by Chucker Android
https://pub.dev/packages/chucker_flutter
MIT License
54 stars 32 forks source link

Unhandled Exception: Converting object to an encodable object failed: Instance of 'ApiResponse' (Dio) #4

Closed su1216 closed 2 years ago

su1216 commented 2 years ago

Describe the bug Error when upload a file (dio.post with FormData), If remove ChuckerDioInterceptor from Dio, then dio works fine.

Log

E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Converting object to an encodable object failed: Instance of 'ApiResponse'

0 _JsonStringifier.writeObject (dart:convert/json.dart:794:7)

1 _JsonStringifier.writeList (dart:convert/json.dart:845:9)

2 _JsonStringifier.writeJsonValue (dart:convert/json.dart:824:7)

3 _JsonStringifier.writeObject (dart:convert/json.dart:785:9)

4 _JsonStringStringifier.printOn (dart:convert/json.dart:983:17)

5 _JsonStringStringifier.stringify (dart:convert/json.dart:968:5)

6 JsonEncoder.convert (dart:convert/json.dart:345:30)

7 JsonCodec.encode (dart:convert/json.dart:231:45)

8 jsonEncode (dart:convert/json.dart:114:10)

9 SharedPreferencesManager.addApiResponse (package:chucker_flutter/src/helpers/shared_preferences_manager.dart:44:7)

\<asynchronous suspension>

10 ChuckerDioInterceptor._saveResponse (package:chucker_flutter/src/interceptors/dio_interceptor.dart:55:5)

\<asynchronous suspension>

11 ChuckerDioInterceptor.onResponse (package:chucker_flutter/src/interceptors/dio_interceptor.dart:35:5)

\<asynchronous suspension>

Version (please complete the following information):

syedmurtaza108 commented 2 years ago

@su1216 Thank you for reporting this bug. I will look into this in the very first available slot.