title: Flutter - Format Exception : Unexpected end of input (at character 1)
body: <p>I'm facing this Exception while loading json from a .json file. complete Exception is :</p>
  <pre><code>E/flutter ( 4062): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: 
  FormatException: Unexpected end of input (at character 1)
  E/flutter ( 4062): 
  E/flutter ( 4062): ^
  E/flutter ( 4062): 
  E/flutter ( 4062): #0      _ChunkedJsonParser.fail (dart:convert-  patch/convert_patch.dart:1405:5)
  E/flutter ( 4062): #1      _ChunkedJsonParser.close (dart:convert-patch/convert_patch.dart:523:7)
  E/flutter ( 4062): #2      _parseJson (dart:convert-patch/convert_patch.dart:41:10)
  E/flutter ( 4062): #3      JsonDecoder.convert (dart:convert/json.dart:506:36)
  E/flutter ( 4062): #4      JsonCodec.decode (dart:convert/json.dart:157:41)
  E/flutter ( 4062): #5      _HomePageState.loadJsonData.&lt;anonymous closure&gt;.&lt;anonymous closure&gt; (package:audio_player/presentation/pages/home_page.dart:22:35)
  E/flutter ( 4062): #6      State.setState (package:flutter/src/widgets/framework.dart:1088:30)
  E/flutter ( 4062): #7      _HomePageState.loadJsonData.&lt;anonymous closure&gt; (package:audio_player/presentation/pages/home_page.dart:20:27)
  E/flutter ( 4062): #8      _rootRunUnary (dart:async/zone.dart:1436:47)
  E/flutter ( 4062): #9      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
  E/flutter ( 4062): &lt;asynchronous suspension&gt;
  E/flutter ( 4062): #10     _HomePageState.loadJsonData (package:audio_player/presentation/pages /home_page.dart:19:5)
  E/flutter ( 4062): &lt;asynchronous suspension&gt;
  </code></pre>
  <p>My Json file path (lib/utils/json/popular_books.json) and code look like this:</p>
  <pre><code>[
    {
     &quot;rating&quot;:&quot;4.5&quot;,
     &quot;title&quot;:&quot;sometitle&quot;,
     &quot;text&quot;:&quot;sometext&quot;,
     &quot;img&quot;:&quot;lib/utils/assets/image_1&quot;,
    }
     ...
  ]
  </code></pre>
  <p>My images are in the same folder utils/assets. I'm loading json</p>
  <pre><code>  List? popularBooks;
  
    loadJsonData() async {
      await DefaultAssetBundle.of(context).loadString(&quot;lib/utils/json/popular_books.json&quot;).then(
            (loadedJson) =&gt; setState(
              () {
                popularBooks = json.decode(loadedJson);
              },
            ),
          );
        }
  
    @override
    void initState() {
    loadJsonData();
    super.initState();
   }
  </code></pre>
  <p>And I'm trying to load only the images in the page view :</p>
  <pre><code>PageView.builder(
                itemCount: popularBooks==null?0:popularBooks!.length,
                controller: _controller,
                itemBuilder: (context, index) {
                  return Container(
                    margin: EdgeInsets.only(right: 10),
                    height: 150,
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(10),
                     ),
                     child: Image.asset(&quot;${popularBooks![index][&quot;img&quot;]}&quot;),
                   );
                 },
               ),
  </code></pre>
  <p>And then this Format Exception If you have any fix please share it I'd me very thankful. &lt;3</p>