# refreshRelations method Null safety

dynamic refreshRelations(

1. GridModel model

)

## Implementation

    static Future<GridModel> refreshRelations(GridModel model) async {
      GridViewModel? gridViewHolder;
      if (model.gridView != null) {
        try {
          await gridViewRepository(appId: model.appId)!
              .get(model.gridView!.documentID)
              .then((val) {
            gridViewHolder = val;
          }).catchError((error) {});
        } catch (_) {}
      }

      List<BodyComponentModel>? bodyComponentsHolder;
      if (model.bodyComponents != null) {
        bodyComponentsHolder = List<BodyComponentModel>.from(
                await Future.wait(model.bodyComponents!.map((element) async {
          return await BodyComponentCache.refreshRelations(element);
        })))
            .toList();
      }

      return model.copyWith(
        gridView: gridViewHolder,
        bodyComponents: bodyComponentsHolder,
      );
    }