title: accessing a variable from another widget
body: <pre><code>CarouselSlider.builder(
            options: CarouselOptions(
              viewportFraction: 1,
            ),
            itemCount: 10,
            itemBuilder: (context, idx, realIndex) {
              return buildImage(articles, urlImages[idx], idx, context);
            },
          ),
          DotsIndicator(
            dotsCount: 10,
            position: idx.toDouble(), //cannot access here idx value
            decorator: DotsDecorator(
              size: const Size.square(6.0),
              activeSize: const Size(22.0, 6.0),
              activeShape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(5.0)),
              activeColor: Colors.blue,
              spacing: const EdgeInsets.all(3.0),
            ),
          ),
        ],
      ),
  </code></pre>
  <p>DotsIndicator position should access the idx value but cannot access it. In worst case I can put DotsIndicator in buildImage class but this time the dots moving with slider which do not wish.</p>
  <p>Without to use Getx how can I get the idx value?</p>