Closed A7Aima closed 4 years ago
I'm Trying to create my own signup setup with all procedure like create session -> sign up -> instance.login -> and create dialog But I'm getting an error.
CODE
void initialize() async { CubeUser cubeUser = CubeUser( login: _loginName.text, fullName: _fullName.text, password: _password.text, ); await _signInCC(context, cubeUser); } Future<void> _signInCC(BuildContext context, CubeUser user) async { if (!CubeSessionManager.instance.isActiveSessionValid()) { try { await createSession(); print("Session Has created"); } catch (error) { print(error); } } signUp(user).then((newUser) { print("signUp newUser $newUser"); user.id = newUser.id; SharedPrefs.instance.saveNewUser(user); // this is different (not related) signIn(user).then((result) { print("Success"); print('${result.fullName}'); print('${result.login}'); print('${result.id}'); print(CubeChatConnection.instance.chatConnectionState); CubeDialog newDialog = CubeDialog( CubeDialogType.PRIVATE, occupantsIds: [1998063, result.id], ); print("Dialog Details $newDialog"); cubeChatConnect(context, result, newDialog); }); }); } void cubeChatConnect( BuildContext context, CubeUser user, CubeDialog newDialog) async { await CubeChatConnection.instance.login(user).then((cubeUser) { // The Error starts from here print("Entering Cube Chat Connection login"); print("dialogue defined ${newDialog.occupantsIds}"); createDialog(newDialog).then((value) { _chatScreen(context, cubeUser, value); }).catchError((onError) { print("Error has occurred inside $onError"); print("Name of Dialog ${newDialog.name}"); }); }).catchError((onError) { print("Error of login $onError"); }); } void _chatScreen(BuildContext context, CubeUser result, CubeDialog value) { print("Inside the create dialogue box"); Navigator.push( context, MaterialPageRoute( builder: (context) => ChatDialogScreen(result, value), ), ); }
and i m getting this kind of error
I/flutter ( 3881): CB-SDK: : ========================================================= I/flutter ( 3881): === REQUEST ==== 7be636e6-32c0-49a6-a2c5-270193682da1 === I/flutter ( 3881): REQUEST I/flutter ( 3881): POST https://api.connectycube.com/users I/flutter ( 3881): HEADERS I/flutter ( 3881): {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 0.4.2, CB-Token: ad018ab810dd428b1b45310b207e33a410000c2d} I/flutter ( 3881): BODY I/flutter ( 3881): {"user":{"full_name":"jsnassn","login":"nndsk","password":"saajbdbxsa"}} I/flutter ( 3881): I/flutter ( 3881): CB-SDK: : ********************************************************* I/flutter ( 3881): *** RESPONSE *** 201 *** 7be636e6-32c0-49a6-a2c5-270193682da1 *** I/flutter ( 3881): HEADERS I/flutter ( 3881): {connection: keep-alive, cache-control: max-age=0, private, must-revalidate, set-cookie: _mkra_ctxt=da0c38969f7075243b94df3db07ef071--201; path=/; max-age=5; HttpOnly; secure, status: 201 Created, transfer-encoding: chunked, date: Fri, 02 Oct 2020 16:10:53 GMT, access-control-allow-origin: *, strict-transport-security: max-age=31536000,max-age=15768000;, content-type: application/json; charset=utf-8, x-xss-protection: 1; mode=block, server: nginx/1.16.1, x-request-id: e327e327-6fbc-4bf3-a6ef-22c774dec42e, cb-token-expirationdate: 2020-10-02 18:07:20 UTC, connectycube-rest-api-version: 0.1.1, location: https://api.connectycube.com/users/2122481, x-runtime: 0.052182, etag: W/"18f53d8106990285adc25fcc99d4a349", x-frame-options: SAMEORIGIN, x-content-type-options: nosniff} I/flutter ( 3881): BODY I/flutter ( 3881): {"user":{"id":2122481,"full_name":"jsnassn","email":null,"login":"nndsk","phone":null,"website":null,"created_at":"2020-10-02T16:10:53Z","updated_at":"2020-10-02T16:10:53Z","last_request_at":null,"external_user_id":null,"facebook_id":null,"twitter_id":null,"blob_id":null,"custom_data":null,"avatar":null,"user_tags":null}} I/flutter ( 3881): I/flutter ( 3881): signUp newUser {full_name: jsnassn, email: null, login: nndsk, phone: null, website: null, last_request_at: null, external_user_id: null, facebook_id: null, twitter_id: null, password: null, oldPassword: null, custom_data: null, avatar: null, tag_list: null, id: 2122481, created_at: 2020-10-02 16:10:53.000Z, updated_at: 2020-10-02 16:10:53.000Z} I/flutter ( 3881): CB-SDK: : ========================================================= I/flutter ( 3881): === REQUEST ==== 5bcdaebb-aeaa-47f8-877c-065b620bb715 === I/flutter ( 3881): REQUEST I/flutter ( 3881): POST https://api.connectycube.com/login I/flutter ( 3881): HEADERS I/flutter ( 3881): {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 0.4.2, CB-Token: ad018ab810dd428b1b45310b207e33a410000c2d} I/flutter ( 3881): BODY I/flutter ( 3881): {"login":"nndsk","password":"saajbdbxsa"} I/flutter ( 3881): E/flutter ( 3881): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: NoSuchMethodError: The method 'setString' was called on null. E/flutter ( 3881): Receiver: null E/flutter ( 3881): Tried calling: setString("pref_user_login", "nndsk") E/flutter ( 3881): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5) E/flutter ( 3881): #1 SharedPrefs.saveNewUser (package:video_calling/utils/user_utils.dart:35:17) E/flutter ( 3881): #2 _RetrieveUserState._signInCC.<anonymous closure> (package:video_calling/Pages/user.dart:109:28) E/flutter ( 3881): #3 _rootRunUnary (dart:async/zone.dart:1198:47) E/flutter ( 3881): #4 _CustomZone.runUnary (dart:async/zone.dart:1100:19) E/flutter ( 3881): #5 _FutureListener.handleValue (dart:async/future_impl.dart:143:18) E/flutter ( 3881): #6 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45) E/flutter ( 3881): #7 Future._propagateToListeners (dart:async/future_impl.dart:725:32) E/flutter ( 3881): #8 Future._completeWithValue (dart:async/future_impl.dart:529:5) E/flutter ( 3881): #9 Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7) E/flutter ( 3881): #10 _rootRun (dart:async/zone.dart:1190:13) E/flutter ( 3881): #11 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter ( 3881): #12 _CustomZone.runGuarded (dart:async/zone.dart:997:7) E/flutter ( 3881): #13 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23) E/flutter ( 3881): #14 _microtaskLoop (dart:async/schedule_microtask.dart:41:21) E/flutter ( 3881): #15 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5) E/flutter ( 3881): I/flutter ( 3881): CB-SDK: : ********************************************************* I/flutter ( 3881): *** RESPONSE *** 202 *** 5bcdaebb-aeaa-47f8-877c-065b620bb715 *** I/flutter ( 3881): HEADERS I/flutter ( 3881): {connection: keep-alive, cache-control: no-cache, set-cookie: _mkra_ctxt=b39c9d306f1278b41d3a4291664f0862--202; path=/; max-age=5; HttpOnly; secure, status: 202 Accepted, transfer-encoding: chunked, date: Fri, 02 Oct 2020 16:10:54 GMT, access-control-allow-origin: *, strict-transport-security: max-age=31536000, content-type: application/json; charset=utf-8, x-xss-protection: 1; mode=block, server: nginx/1.16.1, x-request-id: 62cf6ccd-076b-451b-a797-1ea9be784ac1, cb-token-expirationdate: 2020-10-02 18:07:20 UTC, connectycube-rest-api-version: 0.1.1, x-runtime: 0.033317, x-frame-options: SAMEORIGIN, x-content-type-options: nosniff} I/flutter ( 3881): BODY I/flutter ( 3881): {"user":{"id":2122481,"full_name":"jsnassn","email":null,"login":"nndsk","phone":null,"website":null,"created_at":"2020-10-02T16:10:53Z","updated_at":"2020-10-02T16:10:53Z","last_request_at":"2020-10-02T16:10:54Z","external_user_id":null,"facebook_id":null,"twitter_id":null,"blob_id":null,"custom_data":null,"avatar":null,"user_tags":null}} I/flutter ( 3881): I/flutter ( 3881): Success I/flutter ( 3881): jsnassn I/flutter ( 3881): nndsk I/flutter ( 3881): 2122481 I/flutter ( 3881): CubeChatConnectionState.Idle I/flutter ( 3881): Dialog Details {_id: null, last_message: null, last_message_date_sent: null, last_message_user_id: null, photo: null, user_id: null, xmpp_room_jid: null, unread_messages_count: null, name: null, type: 3, description: null, occupants_count: null, occupants_ids: [1904063, 2122481], pinned_messages_ids: null, admins_ids: null, data: null, id: null, created_at: null, updated_at: null} I/flutter ( 3881): sending: <?xml version='1.0'?> I/flutter ( 3881): <stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' I/flutter ( 3881): to='chat.connectycube.com' I/flutter ( 3881): xml:lang='en' I/flutter ( 3881): > I/flutter ( 3881): State: XmppConnectionState.SocketOpening I/flutter ( 3881): CB-SDK: CubeChatConnection: Chat connection SocketOpening I/flutter ( 3881): response: <xmpp_stone><?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='chat.connectycube.com' id='6244e2a5-24ce-4902-9f16-e7927d7735cd' version='1.0' xml:lang='en'></stream></xmpp_stone> I/flutter ( 3881): processInitialStream I/flutter ( 3881): response: <xmpp_stone><stream:features><sm xmlns="urn:xmpp:sm:3"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>PLAIN_FAST</mechanism></mechanisms><ver xmlns="urn:xmpp:features:rosterver"/><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression></stream:features></xmpp_stone> I/flutter ( 3881): Negotating features I/flutter ( 3881): ELEMENT true I/flutter ( 3881): negotiating starttls I/flutter ( 3881): sending: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/> I/flutter ( 3881): Feature Started Parsing I/flutter ( 3881): response: <xmpp_stone><proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/></xmpp_stone> I/flutter ( 3881): startSecureSocket I/flutter ( 3881): XmppConnectionState.SocketOpening I/flutter ( 3881): sending: <?xml version='1.0'?> I/flutter ( 3881): <stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' I/flutter ( 3881): to='chat.connectycube.com' I/flutter ( 3881): xml:lang='en' I/flutter ( 3881): > I/flutter ( 3881): response: <xmpp_stone><?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='chat.connectycube.com' id='6244e2a5-24ce-4902-9f16-e7927d7735cd' version='1.0' xml:lang='en'></stream></xmpp_stone> I/flutter ( 3881): processInitialStream I/flutter ( 3881): response: <xmpp_stone><stream:features><sm xmlns="urn:xmpp:sm:3"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>PLAIN_FAST</mechanism></mechanisms><ver xmlns="urn:xmpp:features:rosterver"/><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression></stream:features></xmpp_stone> I/flutter ( 3881): Negotating features I/flutter ( 3881): ELEMENT true E/flutter ( 3881): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: Invalid argument(s) E/flutter ( 3881): #0 _StringBase.+ (dart:core-patch/string_patch.dart:267:57) E/flutter ( 3881): #1 PlainSaslHandler.sendPlainAuthMessage (package:xmpp_stone/src/features/sasl/PlainSaslHandler.dart:41:57) E/flutter ( 3881): #2 PlainSaslHandler.start (package:xmpp_stone/src/features/sasl/PlainSaslHandler.dart:24:5) E/flutter ( 3881): #3 SaslAuthenticationFeature._process (package:xmpp_stone/src/features/sasl/SaslAuthenticationFeature.dart:58:19) E/flutter ( 3881): #4 SaslAuthenticationFeature.negotiate (package:xmpp_stone/src/features/sasl/SaslAuthenticationFeature.dart:33:5) E/flutter ( 3881): #5 ConnectionNegotatiorManager.negotiateNextFeature (package:xmpp_stone/src/features/ConnectionNegotatiorManager.dart:84:21) E/flutter ( 3881): #6 ConnectionNegotatiorManager.negotiateFeatureList (package:xmpp_stone/src/features/ConnectionNegotatiorManager.dart:57:5) E/flutter ( 3881): #7 Connection.handleResponse.<anonymous closure> (package:xmpp_stone/src/Connection.dart:299:43) E/flutter ( 3881): #8 Iterable.forEach (dart:core/iterable.dart:283:30) E/flutter ( 3881): #9 Connection.handleResponse (package:xmpp_stone/src/Connection.dart:298:12) E/flutter ( 3881): #10 _rootRunUnary (dart:async/zone.dart:1198:47) E/flutter ( 3881): #11 _CustomZone.runUnary (dart:async/zone.dart:1100:19) E/flutter ( 3881): #12 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7) E/flutter ( 3881): #13 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11) E/flutter ( 3881): #14 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7) E/flutter ( 3881): #15 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:127:11) E/flutter ( 3881): #16 _MapStream._handleData (dart:async/stream_pipe.dart:224:10) E/flutter ( 3881): #17 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:157:13) E/flutter ( 3881): #18 _rootRunUnary (dart:async/zone.dart:1198:47) E/flutter ( 3881): #19 _CustomZone.runUnary (dart:async/zone.dart:1100:19) E/flutter ( 3881): #20 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7) E/flutter ( 3881): #21 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11) E/flutter ( 3881): #22 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7) E/flutter ( 3881): #23 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:69:11) E/flutter ( 3881): #24 _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11) E/flutter ( 3881): #25 _StringAdapterSink.add (dart:convert/string_conversion.dart:238:11) E/flutter ( 3881): #26 _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:243:7) E/flutter ( 3881): #27 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:317:20) E/flutter ( 3881): #28 _Utf8ConversionSink.add (dart:convert/string_conversion.dart:310:5) E/flutter ( 3881): #29 _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:72:18) E/flutter ( 3881): #30 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:121:24) E/flutter ( 3881): #31 _rootRunUnary (dart:async/zone.dart:1198:47) E/flutter ( 3881): #32 _CustomZone.runUnary (dart:async/zone.dart:1100:19) E/flutter ( 3881): #33 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7) E/flutter ( 3881): #34 CastStreamSubscription._onData (dart:_internal/async_cast.dart:85:11) E/flutter ( 3881): #35 _rootRunUnary (dart:async/zone.dart:1198:47) E/flutter ( 3881): #36 _CustomZone.runUnary (dart:async/zone.dart:1100:19) E/flutter ( 3881): #37 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7) E/flutter ( 3881): #38 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11) E/flutter ( 3881): #39 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7) E/flutter ( 3881): #40 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:808:19) E/flutter ( 3881): #41 _StreamController._add (dart:async/stream_controller.dart:682:7) E/flutter ( 3881): #42 _StreamController.add (dart:async/stream_controller.dart:624:5) E/flutter ( 3881): #43 _Socket._onData (dart:io-patch/socket_patch.dart:2020:41) E/flutter ( 3881): #44 _rootRunUnary (dart:async/zone.dart:1198:47) E/flutter ( 3881): #45 _CustomZone.runUnary (dart:async/zone.dart:1100:19) E/flutter ( 3881): #46 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7) E/flutter ( 3881): #47 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11) E/flutter ( 3881): #48 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7) E/flutter ( 3881): #49 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:808:19) E/flutter ( 3881): #50 _StreamController._add (dart:async/str I/flutter ( 3881): response: <xmpp_stone></stream:stream></stream></xmpp_stone> I/flutter ( 3881): State: XmppConnectionState.Closed I/flutter ( 3881): CB-SDK: CubeChatConnection: Chat connection Closed I/flutter ( 3881): !!!!!!!!!!!Handle secured connection done
After this line
I/flutter ( 3881): Success I/flutter ( 3881): jsnassn I/flutter ( 3881): nndsk I/flutter ( 3881): 2122481 I/flutter ( 3881): CubeChatConnectionState.Idle
It Doesn't go through Login Process
I just want to go through all login process and then go to the next widget of chat screen but I'm unable
hello @A7Aima, in the log I can see few logins to chat at the same time. Can you check, how many times calls method cubeChatConnect?
cubeChatConnect
Closing, as there was no activity for a long time
I'm Trying to create my own signup setup with all procedure like create session -> sign up -> instance.login -> and create dialog But I'm getting an error.
CODE
and i m getting this kind of error
After this line
It Doesn't go through Login Process
I just want to go through all login process and then go to the next widget of chat screen but I'm unable