Skip to content
This repository was archived by the owner on Nov 18, 2025. It is now read-only.

Tinode Connect and Disconnect Issue #11

@cfanboy

Description

@cfanboy

Hi, I'm coming again.
I initialized the Tincode as below codes on app startup:

if (tinode == null){
        tinode = Tinode(
            'Wow',
            ConnectionOptions(WebSocketUtils.WsUrl, WebSocketUtils.ApiKey, secure: true),
            ApiConstant.isDebug);
}
 
CtrlMessage connectResult = await tinode.connect();
if (connectResult.code < 300) {
  isConnect = true;
}

When the user logout, call the disconnect method and set the tinode instance to null:

disConnect() {
    tinode.disconnect();
    tinode = null;
}

But after the user signs in again, I re-call the initialization method, it throws the error:

Invalid argument(s): Object/factory with  type ConfigService is already registered inside GetIt. 
      throwIf (package:get_it/get_it_impl.dart:7:18)
#1      _GetItImplementation._register (package:get_it/get_it_impl.dart:800:5)
#2      _GetItImplementation.registerSingleton (package:get_it/get_it_impl.dart:585:5)
#3      Tinode._registerDependencies (package:tinode/tinode.dart:123:13)
#4      new Tinode (package:tinode/tinode.dart:114:5)
#5      WebSocketUtils.connectService (package:wow/pages/home/messages/websocket_utils.dart:37:18)
#6      WebSocketUtils.login (package:wow/pages/home/messages/websocket_utils.dart:54:13)
<asynchronous suspension>

I'm not sure what's problem is, is my disconnect not correct?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions