getUser static method
Future<User?>
getUser(
- String uid, {
- required dynamic onSuccess(
- User user
- required dynamic onError(
- CometChatException excep
Retrieve Particular User Details
uid
: The UID of the user for whom the details are to be fetched
Implementation
static Future<User?> getUser(String uid, {required Function(User user)? onSuccess, required Function(CometChatException excep)? onError}) async {
try {
final result = await channel.invokeMethod('getUser', {'uid': uid});
final User res = User.fromMap(result);
if(onSuccess != null) onSuccess(res);
return res;
} on PlatformException catch (platformException) {
if(onError != null) onError(CometChatException(platformException.code, platformException.details, platformException.message));
} catch (e) {
debugPrint("Error: $e");
if(onError != null) onError(CometChatException(ErrorCode.errorUnhandledException, e.toString() , e.toString()));
}
return null;
}