Home > Software engineering >  Unexpected character (at character 2) while parsing json using dio
Unexpected character (at character 2) while parsing json using dio

Time:12-19

I was getting data from api using dio. It was successful but when data gets and it gets an exception.

Unexpected character (at character 2) {data:{id:5, name: ....

in error log, shows an arrow in beneath d(data)

What to do?

CodePudding user response:

When I changed responsetype only for this API. It worked.

await dio.get(
    url, 
    options: Options(
        responseType: ResponseType.plain,
    ),

  • Related