talkjs-examples icon indicating copy to clipboard operation
talkjs-examples copied to clipboard

Chatbox screen not loading in flutter

Open chima94 opened this issue 2 years ago • 1 comments

The chatbox screen loads sometimes and other time it does not. This happens when I want to create a new conversation. I have followed the doc and its code step by step and still getting same error.

The code i am working with:

class ChatBoxPage extends StatefulWidget {
   const ChatBoxPage({Key? key}) : super(key: key);

  @override
   State<ChatBoxPage> createState() => _ChatBoxPageState();
}

 class _ChatBoxPageState extends State<ChatBoxPage> {
    bool isLoading = false;

    @override
    Widget build(BuildContext context) {

    final session = Session(appId: 'MyAPPID'); //my app id

    final me = session.getUser(
        id: '99876',
        name: 'collins',
        email: ['[email protected]'],
        photoUrl: 'https://talkjs.com/images/avatar-1.jpg',
        welcomeMessage: 'Hey there! How are you? :-)',
        role: 'default',
    );

    session.me = me;

    final other = session.getUser(
      id: '09087',
      name: 'Ify',
      email: ['[email protected]'],
      photoUrl: 'https://talkjs.com/images/avatar-5.jpg',
      welcomeMessage: 'Hey, how can I help?',
      role: 'default',
    );

    final conversation = session.getConversation(
      id: Talk.oneOnOneId(me.id, other.id),
      participants: {Participant(me), Participant(other)},
    );
    return Scaffold(
      appBar: AppBar(
        title: const Text('TalkJS Demo'),
      ),
      body: ChatBox(
        session: session,
        conversation: conversation,
        asGuest: true,
      ),
    );
  }
}

Please i will really appreciate a quick response as my appplication depends on the chat functionality

chima94 avatar Feb 04 '23 20:02 chima94

Hi, you mention that the chat sometimes loads and sometimes doesn't. Do you see any errors in the console when it doesn't work?

I have asked my colleague that's more familiar with the flutter SDK to take a look at this. In the mean time, I'd encourage you to contact us via live chat. You'll still end up chatting with a developer that way, but we can share sensitive details like App / User / Conversation IDs without leaking them. You can contact us by clicking the chat button in the bottom right of talkjs.com

stevenwaterman avatar Feb 06 '23 08:02 stevenwaterman