Answers for "DioError (DioError [DioErrorType.DEFAULT]: Converting object to an encodable object failed: Instance of"

1

DioError (DioError [DioErrorType.DEFAULT]: Converting object to an encodable object failed: Instance of

// You need to add a toJson on your class.
// In my case was the params that were being sent to the api
/// var inputParams = new BlaBla(prop1: null, prop2: null).toJson();

class BlaBla {
String prop1;
String prop2;

BlaBla({this.prop1,this.prop2});

Map toJson() => {"prop1": prop1, "prop2": prop2}; // <-- add this
}
Posted by: Guest on September-10-2020

Code answers related to "DioError (DioError [DioErrorType.DEFAULT]: Converting object to an encodable object failed: Instance of"

Code answers related to "Dart"

Browse Popular Code Answers by Language