onInit method

  1. @override
void onInit()
override

Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.

Implementation

@override
void onInit() {
  super.onInit();
  videoList.addAll(reelsVideoList);
  // Initialize animation controller
  animationController =
      AnimationController(vsync: this, duration: const Duration(seconds: 5));
  animation = CurvedAnimation(
    parent: animationController,
    curve: Curves.easeIn,
  );
  // Initialize service and start timer
  initService();
  timer = Timer.periodic(const Duration(seconds: 1), (Timer t) {
    if (lastIndex != null) {
      initNearByVideos(lastIndex!);
    }
  });
}