createGroup method

Future createGroup(
  1. Map<String, dynamic> params
)

Implementation

Future<dynamic> createGroup(Map<String, dynamic> params) async {
  try {
    final formatedParams = V2TimGroupCreate.formateParams(params);
    final res =
        await wrappedPromiseToFuture(timeweb!.createGroup(formatedParams));
    final code = res.code;
    final data = jsToMap(res.data);
    if (code == 0) {
      return CommonUtils.returnSuccess<String>(
          jsToMap(data['group'])['groupID']);
    } else {
      return CommonUtils.returnErrorForValueCb<String>(
          'some errors when create group');
    }
  } catch (error) {
    return CommonUtils.returnErrorForValueCb<String>(error.toString());
  }
}