goToChatPage<T extends Object?> function
Future<T?>
goToChatPage<T extends Object?>(
- BuildContext context,
- String conversationId,
- NIMConversationType type, {
- NIMMessage? message,
- int? anchorDate,
- bool forceLinearChat = false,
Implementation
Future<T?> goToChatPage<T extends Object?>(
BuildContext context, String conversationId, NIMConversationType type,
{NIMMessage? message,
int? anchorDate,
bool forceLinearChat = false}) async {
final shouldOpenBotSubsession =
!forceLinearChat && _shouldOpenBotSubsession(conversationId, type);
if (ChatKitUtils.isDesktopOrWeb && _desktopChatNavigator != null) {
Navigator.popUntil(context, (route) => route.isFirst);
_desktopChatNavigator!(
conversationId,
forceLinearChat: forceLinearChat,
topicContext: null,
);
return null;
}
if (shouldOpenBotSubsession) {
return _pushBotSubsessionList(context, conversationId, type);
}
if (IMKitRouter.instance.enableGoRouter) {
return context.pushNamed(RouterConstants.PATH_CHAT_PAGE, extra: {
'conversationId': conversationId,
'conversationType': type,
'anchor': message,
'anchorDate': anchorDate,
});
}
return Navigator.pushNamed(context, RouterConstants.PATH_CHAT_PAGE,
arguments: {
'conversationId': conversationId,
'conversationType': type,
'anchor': message,
'anchorDate': anchorDate,
});
}