title: Getting Index From Carousel slider -Flutter
body: <p>I,m using the carousel slider package in my code , i'm trying to extract an index from this slider to add to my dot indicator at the bottom of the slider :
  I.m using 2 packages : <a href="https://pub.dev/packages/carousel_slider" rel="nofollow noreferrer">https://pub.dev/packages/carousel_slider</a> and <a href="https://pub.dev/packages/dots_indicator" rel="nofollow noreferrer">Dot Indicator</a></p>
  <pre><code> Padding(
                padding: EdgeInsets.fromLTRB(
                    size.width * 0.05, 35, size.width * 0.05, 0),
                child: CarouselSlider(
                  options: CarouselOptions(
                    aspectRatio: 2.0,
                    enlargeCenterPage: true,
                    scrollDirection: Axis.horizontal,
                    autoPlay: true,
                  ),
                  items: [
                    Card(
                      clipBehavior: Clip.antiAlias,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(20),
                      ),
                      child: Image(
                        image: AssetImage(&quot;assets/greenhouse.jpg&quot;),
                      ),
                    ),
                    Card(
                      clipBehavior: Clip.antiAlias,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(20),
                      ),
                      child: Image(
                        image: AssetImage(&quot;assets/greenhouse.jpg&quot;),
                      ),
                    ),
                  ],
                ),
              ),
              new DotsIndicator(
                dotsCount: 5,
                position: 1,
                decorator: DotsDecorator(
                  color: Colors.grey,
                  activeColor: greencol,
                ),
              ),
  </code></pre>