Flutter : Error on line 1, column 32: Invalid media type: expected /[^()<>@,;:"\\/[\]?={} \t\x00-\x1F\x7F]+/

Viewed 642

I am making post form data request using "dio 3.0.9" library but i am getting below Error

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: DioError [DioErrorType.DEFAULT]: Error on line 1, column 32: Invalid media type: expected /[^()<>@,;:"\/[]?={} \t\x00-\x1F\x7F]+/. ╷ 1 │ application/json;charset=utf-8;

Below is my code -

FormData formData = new FormData.fromMap({"device_id": deviceId, "device_token":"${deviceToken}",
      "platform":"IOS"
    });

  Dio dio = new Dio();
  Response response = await dio.post(url, data: formData, options: Options(
           contentType: "application/json"));
0 Answers
Related