login static method
Future<User?>
login(
- String uid,
- String authKey, {
- required dynamic onSuccess(
- User user
- required dynamic onError(
- CometChatException excep
Use this function only for testing purpose. For production, use loginWithAuthToken
Implementation
static Future<User?> login(String uid, String authKey,
{required Function(User user)? onSuccess,
required Function(CometChatException excep)? onError}) async {
try {
final result = await channel.invokeMethod('loginWithApiKey', {
'uid': uid,
'apiKey': authKey,
});
final User res = User.fromMap(result);
if (onSuccess != null) onSuccess(res);
return res;
} on PlatformException catch (p) {
_errorCallbackHandler(null, p, null, onError);
} catch (e) {
_errorCallbackHandler(null, null, e, onError);
}
return null;
}