Open SnehModi opened 4 years ago
CarouselSlider( items: widget.data.map((e) { return Builder( builder: (context) { return Container( padding: EdgeInsets.all(10), child: Center( child: Image.network( e.imageUrl, fit: BoxFit.fill, ), ), ); }, ); }).toList(), options: CarouselOptions( autoPlay: false, enableInfiniteScroll: false, height: height, viewportFraction: 1, initialPage: currentindex)),
The above code is giving the following exception.
E/flutter (20243): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: 'package:flutter/src/widgets/page_view.dart': Failed assertion: line 180 pos 7: 'positions.isNotEmpty': PageController.page cannot be accessed before a PageView is built with it. E/flutter (20243): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39) E/flutter (20243): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5) E/flutter (20243): #11 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19) E/flutter (20243): #12 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5) E/flutter (20243): #13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12) E/flutter (20243): #2 PageController.page package:flutter/…/widgets/page_view.dart:180 E/flutter (20243): #3 CarouselSliderState.getTimer.<anonymous closure> package:carousel_slider/carousel_slider.dart:111 E/flutter (20243): #4 _rootRunUnary (dart:async/zone.dart:1192:38) E/flutter (20243): #5 _CustomZone.runUnary (dart:async/zone.dart:1085:19) E/flutter (20243): #6 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7) E/flutter (20243): #7 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1024:26) E/flutter (20243): #8 _rootRunUnary (dart:async/zone.dart:1196:13) E/flutter (20243): #9 _CustomZone.runUnary (dart:async/zone.dart:1085:19) E/flutter (20243): #10 _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1008:26) E/flutter (20243): #11 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19) E/flutter (20243): #12 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5) E/flutter (20243): #13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12) E/flutter (20243):
Hey! I have the same issue. Did you fix that ?
@SnehModi i have the same issue.Did you find some solution for this error?
The above code is giving the following exception.