flutterquickblox

Flutter: Unable to send message via quickblox


This question belong to those who has worked with quickblox sdk.

I am going to create a chat application by quickBlox sdk. I installed package from pub.dev and it work fine with create user, login and create dialog but when I called send method I face with this error any one help me.

[  +22 ms] E/MethodChannel#FlutterQBChatChannel(20162): Failed to handle method call
[   +1 ms] E/MethodChannel#FlutterQBChatChannel(20162): java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
[   +1 ms] E/MethodChannel#FlutterQBChatChannel(20162):         at com.quickblox.quickblox_sdk.chat.ChatModule.sendMessage(ChatModule.java:681)
[  +12 ms] E/MethodChannel#FlutterQBChatChannel(20162):         at com.quickblox.quickblox_sdk.chat.ChatModule.handleMethod(ChatModule.java:148)
[   +9 ms] E/MethodChannel#FlutterQBChatChannel(20162):         at
com.quickblox.quickblox_sdk.chat.-$$Lambda$DVgH6HdFVfXJ1jon6MQo8bSJBRA.onMethodCall(Unknown Source:2)
[   +1 ms] E/MethodChannel#FlutterQBChatChannel(20162):         at
io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
[        ] E/MethodChannel#FlutterQBChatChannel(20162):         at
io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
[   +1 ms] E/MethodChannel#FlutterQBChatChannel(20162):         at
io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart$0$DartMessenger(DartMessenger.java:206)
[   +1 ms] E/MethodChannel#FlutterQBChatChannel(20162):         at
io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$6ZD1MYkhaLxyPjtoFDxe45u43DI.run(Unknown Source:12)
[        ] E/MethodChannel#FlutterQBChatChannel(20162):         at android.os.Handler.handleCallback(Handler.java:873)
[        ] E/MethodChannel#FlutterQBChatChannel(20162):         at android.os.Handler.dispatchMessage(Handler.java:99)
[        ] E/MethodChannel#FlutterQBChatChannel(20162):         at android.os.Looper.loop(Looper.java:193)
[   +1 ms] E/MethodChannel#FlutterQBChatChannel(20162):         at android.app.ActivityThread.main(ActivityThread.java:6669)
[   +1 ms] E/MethodChannel#FlutterQBChatChannel(20162):         at java.lang.reflect.Method.invoke(Native Method)
[   +3 ms] E/MethodChannel#FlutterQBChatChannel(20162):         at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[  +37 ms] E/MethodChannel#FlutterQBChatChannel(20162):         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
[  +24 ms] I/flutter (20162): java.lang.String cannot be cast to java.lang.Long//null//java.lang.ClassCastException: java.lang.String
cannot be cast to java.lang.Long
[   +2 ms] I/flutter (20162):   at com.quickblox.quickblox_sdk.chat.ChatModule.sendMessage(ChatModule.java:681)
[   +1 ms] I/flutter (20162):   at com.quickblox.quickblox_sdk.chat.ChatModule.handleMethod(ChatModule.java:148)
[   +2 ms] I/flutter (20162):   at com.quickblox.quickblox_sdk.chat.-$$Lambda$DVgH6HdFVfXJ1jon6MQo8bSJBRA.onMethodCall(Unknown Source:2)  
[   +1 ms] I/flutter (20162):   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)     
[   +1 ms] I/flutter (20162):   at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
[   +1 ms] I/flutter (20162):   at
io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart$0$DartMessenger(DartMessenger.java:206)
[   +1 ms] I/flutter (20162):   at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$6ZD1MYkhaLxyPjtoFDxe45u43DI.run(Unknown       
Source:12)
[        ] I/flutter (20162):   at android.os.Handler.handleCallback(Handler.java:873)
[   +1 ms] I/flutter (20162):   at android.os.Handler.dispatchMessage(Handler.java:99)
[        ] I/flutter (20162):   at android.os.Looper.loop(Looper.java:193)
[        ] I/flutter (20162):   at android.app.ActivityThread.main(A


Solution

  • This Exception occurs, because of the dateSent parameter. I faced the same problem I was able to solve it by sending null as value, because dateSent is not required.