title: "RangeError (index)" when trying to replicate the Netflix UI by using Flutter and Firebase
body: <p>I'm making clone of Netflix-UI by using flutter and firebase. And I have some problem about it. I've been trying to solve it for 1 week but I can't.</p>
  <p>When I run this app it has message</p>
  <blockquote>
  <p>RangeError (index): Invalid value: Valid value range is empty: 0'</p>
  </blockquote>
  <p>I upload my project in github.. plz help
  <a href="https://github.com/woosihyeon/fluuterandfirebase_app" rel="nofollow noreferrer">https://github.com/woosihyeon/fluuterandfirebase_app</a></p>
  <p>This is the code:</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:fluuterandfirebase_app/model_movie/model_movie.dart';
  import 'package:carousel_slider/carousel_slider.dart';
  import 'package:fluuterandfirebase_app/widget/carousel_slider.dart';
  import 'package:fluuterandfirebase_app/widget/circle_slider.dart';
  import 'package:fluuterandfirebase_app/widget/box_slider.dart';
  import 'package:cloud_firestore/cloud_firestore.dart';
  
  class HomeScreen extends StatefulWidget {
    @override
    _HomeScreenState createState() =&gt; _HomeScreenState();
  }
  
  
  class _HomeScreenState extends State&lt;HomeScreen&gt; {
    FirebaseFirestore firebaseFirestore = FirebaseFirestore.instance;
    Stream&lt;QuerySnapshot&gt; streamData;
    @override
    void initState() {
      super.initState();
      streamData = firebaseFirestore.collection('movies').snapshots();
    }
  
    Widget _fetchData(BuildContext context) {
      return StreamBuilder&lt;QuerySnapshot&gt;(
        stream: FirebaseFirestore.instance.collection('movies').snapshots(),
        builder: (BuildContext context,AsyncSnapshot&lt;QuerySnapshot&gt; snapshot){
          if(!snapshot.hasData) return LinearProgressIndicator();
          return _buildBody(context, snapshot.data.docs);
        },
      );
    }
  
    Widget _buildBody(BuildContext context,List&lt;DocumentSnapshot&gt; snapshot){
      List&lt;Movie&gt; movies = snapshot.map((d) =&gt; Movie.fromSnapshot(d)).toList();
      return ListView(
        children:&lt;Widget&gt;[
          Stack(
            children: &lt;Widget&gt;[
              CarouseImage(movies: movies),
              TopBar(),
            ],
          ),
          CircleSlider(
            movies: movies,
          ),
          BoxSlider(
            movise: movies,
          ),
        ],
      );
  
    }
  
    @override
    Widget build(BuildContext context) {
      return _fetchData(context);
    }
  }
  
  class TopBar extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return Container(
        padding: EdgeInsets.fromLTRB(20, 7, 20, 7),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: &lt;Widget&gt;[
            Image.asset(
              'images/bbongflix_logo.png',
              fit: BoxFit.contain,
              height: 25.0,
            ),
            Container(
              padding: EdgeInsets.only(right: 1),
              child: Text(
                'TV 프로그램',
                style: TextStyle(fontSize: 14.0),
              ),
            ),
            Container(
              padding: EdgeInsets.only(right: 1),
              child: Text(
                '영화',
                style: TextStyle(fontSize: 14.0),
              ),
            ),
            Container(
              padding: EdgeInsets.only(right: 1),
              child: Text(
                '내가 찜한 콘텐츠',
                style: TextStyle(fontSize: 14.0),
              ),
            ),
          ],
        ),
      );
    }
  }
  </code></pre>