2019-03-26 22:47



I'm trying to parse data from json but something is wrong. Terminal console says:

Performing hot restart...
Restarted application in 1.659ms.
I/flutter ( 9594): Load xd en
I/flutter ( 9594): Exception: FormatException: Unexpected end of input (at character 1)
I/flutter ( 9594):
I/flutter ( 9594): ^
I/flutter ( 9594): /0
I/flutter ( 9594): error: 0

My json can be found here: link

But at this link it works when I try to parse data from json, and both json's looks same. ( at this one I do not have access to PHP file)

I did json print as usually, like this:

$myJson = ['op'=>true,'msg'=>'','data'=>['pages'=>3538,'page'=>(int)$stranica,'news'=>$api]];

Is there any trick/hack about this? Am I missing something?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • dopq87915 dopq87915 2年前

    been struggling wit the same error since yesterday... whats strange that POST req is fired, but the exception was thrown anyway..

    in my case, the problem was one of the temporary functions returning the response:

    //      Response registerResponse = await, data: requestBody, options: new Options(contentType: ContentType("application", "json")));
    //      print(TAG + registerResponse.toString());
    //      print(TAG +;
    //      Map<String, dynamic> parsedregisterResponse = jsonDecode(;
    //      print(TAG + "response: " + parsedregisterResponse.toString());

    used to monitor the output - will find out which one (probably Map) this evening and let u know. In the meantime recheck your response type and decoding -there must be something wrong with it just like in my case.

    点赞 评论 复制链接分享