onInit method

  1. @override
Future<void> onInit()
override

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

Implementation

@override
Future<void> onInit() async {
  // arguments = NavUtils.arguments as ChatViewArguments;
  // buildContext = context;
  showChatDeliveryIndicator = arguments?.showChatDeliveryIndicator ?? true;

  getAvailableFeatures();

  if ((arguments?.topicId).checkNull().isNotEmpty) {
    topicId = arguments!.topicId;
    getTopicDetail();
  }

  if ((arguments?.chatJid).checkNull().isNotEmpty) {
    nJid = arguments!.chatJid;
    debugPrint("parameter :${arguments!.chatJid}");
  }

  if (arguments?.messageId != null) {
    starredChatMessageId = arguments!.messageId;
  }
  SessionManagement.setCurrentChatJID(nJid.checkNull());
  await getChatProfile();

  setAudioPath();

  filteredPosition.bindStream(filteredPosition.stream);
  ever(filteredPosition, (callback) {
    lastPosition(callback.length);
    //chatList.refresh();
  });
  super.onInit();
}