createGroup method

  1. @override
Future<void> createGroup(
  1. String groupName,
  2. List<String> userJidList,
  3. String imageFilePath,
  4. dynamic callback(
    1. FlyResponse response
    )?,
)
override

This method is used to create the group.

Implementation

@override
Future<void> createGroup(String groupName, List<String> userJidList,
    String imageFilePath, Function(FlyResponse response)? callback) async {
  String? response;
  try {
    response = await mirrorFlyMethodChannel.invokeMethod('createGroup', {
      "group_name": groupName,
      "members": userJidList,
      "file": imageFilePath,
    });
    LogMessage.d("create group Response ", " $response");
    callback?.call(FlyResponse(
        true, response ?? FlyConstants.empty, FlyConstants.empty));
    // return response;
  } on PlatformException catch (e) {
    LogMessage.d("Platform Exception =", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
        FlyException(e.code, e.message, e.details)));
  } on Exception catch (e) {
    LogMessage.d("Exception ", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
        FlyException(FlyErrorCode.unHandle, FlyErrorMessage.unHandle, e)));
  }
}