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() {
  _populateChats();

  scrollController.addListener(_updateScrollPosition);

  _nextInterval = interval(
    _scrollPosition,
    (_) => _next(),
    time: const Duration(milliseconds: 100),
    condition:
        () =>
            scrollController.hasClients &&
            (scrollController.position.pixels >
                scrollController.position.maxScrollExtent - 500),
  );

  super.onInit();
}