android – how one can fetch information into listview? [flutter]

[ad_1]

i wish to fetch the information into listview, but it surely hold crashing, i already fetch the api and put it in UI. how is the choice method to fetch the api, assist, i would like any reply

class NowPlayingPages extends StatelessWidget {
  const NowPlayingPages({Key? key}) : tremendous(key: key);
  @override
  Widget construct(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(

          brightness: Brightness.darkish,
          primaryColor: Colours.blue
      ),
    );
  }
}

class Dwelling extends StatefulWidget {
  const Dwelling({Key? key}) : tremendous(key: key);

  @override
  State<Dwelling> createState() => _HomeState();
}

class _HomeState extends State<Dwelling> {

  Record now_playing = [];
  last String apikey ='0780e6689e1189ea7b55c2a7ef7cc969';
  last readaccesstoken = 'eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIwNzgwZTY2ODllMTE4OWVhN2I1NWMyYTdlZjdjYzk2OSIsInN1YiI6IjYyNmEzMjQ0OTBkZGUwMDBhNmUyYjEyMSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.tmT_rASDXvRLFurM3MHnEuDxYCpfjEBJdC2hfXnULGs';

  @override
  void initState(){
    loadmovies();
    tremendous.initState();
  }

  loadmovies()async{
    TMDB tmdbWithCustomLogs = TMDB(ApiKeys(apikey, readaccesstoken),
        logConfig: ConfigLogger(
            showLogs: true,
            showErrorLogs: true
        ));
    Map now_playingresult = await tmdbWithCustomLogs.v3.motion pictures.getNowPlaying();
    setState(() {
      now_playing = now_playingresult['results'];
    });
  }


  @override
  Widget construct(BuildContext context) {

    return Container(
      padding: EdgeInsets.all(10),
      baby: Column(
        crossAxisAlignment: CrossAxisAlignment.begin,
        kids: [
          modified_text(text:'Now Playing', size: 26,color: Colors.white,),
          SizedBox(height: 37,),
          Container(height: 297,
            child: ListView.builder(
               itemCount: now_playing.length,
                scrollDirection: Axis.horizontal,
                itemBuilder: (context, index){
                  return InkWell(
                    child: Container(
                      width: 167,
                      child: Column(
                        children: [
                          Container(
                            height:227,
                            decoration: BoxDecoration(image :DecorationImage(
                                image: NetworkImage(
                                    'https://image.tmdb.org/t/p/w500' + now_playing[index]['poster_path']
                                )
                            )),
                          ),
                          Container(baby: modified_text(textual content:now_playing[index]['title']!=null?
                          now_playing[index]['title']:'Loading', measurement: 14, colour: Colours.white,))
                        ],
                      ),
                    ),
                  );
                }),)
        ],
      ),
    );
  }
}

please assist me to search out the bug, i do not actually know the place the error is, im new to flutter

that is the element of how i fetch the information:

class Dwelling extends StatefulWidget {
  const Dwelling({Key? key}) : tremendous(key: key);

  @override
  State<Dwelling> createState() => _HomeState();
}

class _HomeState extends State<Dwelling> {

  Record now_playing = [];
  last String apikey ='0780e6689e1189ea7b55c2a7ef7cc969';
  last readaccesstoken = 'eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIwNzgwZTY2ODllMTE4OWVhN2I1NWMyYTdlZjdjYzk2OSIsInN1YiI6IjYyNmEzMjQ0OTBkZGUwMDBhNmUyYjEyMSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.tmT_rASDXvRLFurM3MHnEuDxYCpfjEBJdC2hfXnULGs';

  @override
  void initState(){
    loadmovies();
    tremendous.initState();
  }

  loadmovies()async{
    TMDB tmdbWithCustomLogs = TMDB(ApiKeys(apikey, readaccesstoken),
        logConfig: ConfigLogger(
            showLogs: true,
            showErrorLogs: true
        ));
    Map now_playingresult = await tmdbWithCustomLogs.v3.motion pictures.getNowPlaying();
    setState(() {
      now_playing = now_playingresult['results'];
    });
  }

[ad_2]

Leave a Reply