getJoinedGroupList method

Future getJoinedGroupList()

Implementation

Future<dynamic> getJoinedGroupList() async {
  try {
    final res = await wrappedPromiseToFuture(timeweb!.getGroupList());
    var code = res.code;
    if (code == 0) {
      var groupList = jsToMap(res.data)['groupList'] as List;
      // var groupProfileList = List.empty(growable: true);
      // for (var element in groupList) {
      //   final groupID = jsToMap(element)["groupID"];
      //   final groupProfile = await getGroupProfile(groupID);
      //   groupProfileList.add(groupProfile);
      // }
      final result = V2TimGroupCreate.formateGroupListResult(groupList);
      return CommonUtils.returnSuccess<List<V2TimGroupInfo>>(result);
    } else {
      return CommonUtils.returnErrorForValueCb<List<V2TimGroupInfo>>(
          "getJoinedList Failed");
    }
  } catch (error) {
    return CommonUtils.returnErrorForValueCb<List<V2TimGroupInfo>>(
        error.toString());
  }
}