Open SYND-GITHUB opened 2 years ago
If you try to use something like animateToPage etc. you can try it https://stackoverflow.com/questions/64822800/null-check-operator-used-on-a-null-value-carousel-flutter
I have same problem .what did you do to solve this problem ??
I have same problem .what did you do to solve this problem ??
Try to put initialization the carouselController inside the initState method.
This is my case
class _PlansPageState extends State<PlansPage> {
int _currentPage = 1;
late CarouselController carouselController;
@override
void initState() {
super.initState();
carouselController = CarouselController();
}
}
Then I was able to use
carouselController.animateToPage(_currentPage);
in onTap inside GestureDetector
I had the same issues because I forgot to add the carouselController
to the CarouselSlider
:
CarouselSlider.builder( carouselController: carouselController, ...
+1
The same problem. Does anyone have a solution?
I'm using carousel_slider: ^4.1.1
E/flutter (27320): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Null check operator used on a null value E/flutter (27320): #0 CarouselSliderState.getTimer. (package:carousel_slider/carousel_slider.dart:135:63)
E/flutter (27320): #1 _rootRunUnary (dart:async/zone.dart:1434:47)
E/flutter (27320): #2 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (27320): #3 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (27320): #4 _CustomZone.bindUnaryCallbackGuarded. (dart:async/zone.dart:1281:26)
E/flutter (27320): #5 _rootRunUnary (dart:async/zone.dart:1442:13)
E/flutter (27320): #6 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (27320): #7 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:1265:26)
E/flutter (27320): #8 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/flutter (27320): #9 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/flutter (27320): #10 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)