Open mmc-eastwolf opened 2 years ago
if you got RangeError you need to catch it ` @override void handleCallback(String callbackId, String callbackName, List args) { final callback = _callbacks[callbackId]!;
switch (callbackName) {
case "onInterestChanges":
callback((args[0] as List<Object?>).cast<String>());
return;
case "setUserId":
try{
callback(args[0] as String?);
}on RangeError{
callback("sucess");
}
return;
case "onMessageReceivedInTheForeground":
callback((args[0] as Map<Object?, Object?>));
return;
default:
callback();
return;
}
}` because when success args is empty list
PusherBeams.instance.setUserId(...) works fine for me. Can you paste your client code here as well? The server's response looks correct.
This is the function that should create the token.
getSecure() async {
final BeamsAuthProvider provider = BeamsAuthProvider()
..authUrl = 'https://<my-server>/secure'
..headers = {'Content-Type': 'application/json'}
..credentials = 'omit';
await PusherBeams.instance.setUserId(
'user-id',
provider,
(error) => {
if (error != null) {print(error)}
// Success! Do something...
});
}
Any updates on this ?
Laravel route that returns the token :
Response from our server :
Error :
Flutter doctor output :