getGroup static method

Future<Group?> getGroup(
  1. String guid, {
  2. required dynamic onSuccess(
    1. Group retGrou
    )?,
  3. required dynamic onError(
    1. CometChatException excep
    )?,
})

Retrieve information for a specific group

guid guid of group

method could throw PlatformException with error codes specifying the cause

Implementation

static Future<Group?> getGroup(String guid, {required Function(Group retGrou)? onSuccess, required Function(CometChatException excep)? onError}) async {
  try {
    final result = await channel.invokeMethod('getGroup', {
      'guid': guid,
    });
    final Group res = Group.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;
}