retrieveLandingPage method

Future retrieveLandingPage(
  1. String deviceType
)

Implementation

Future retrieveLandingPage(String deviceType) async {
  GraphQLClient _client = graphQLConfiguration.clientToQuery();

  var retrieveLandingPageGql = """
                query retrieveLandingPage(\$deviceType: String) {
              retrieveLandingPage(deviceType: \$deviceType) {
                _id
                title
                contents {
                  _id
                  position
                  homeContentId {
                    _id
                    name
                    status
                    contentType
                    displayType
                    count
                    banners {
                      _id
                      title
                      imageName
                      status
                      link
                      __typename
                    }
                    promotions {
                      _id
                      packId
                      pack {
                        _id
                        packSKU
                        packName
                        packImages {
                          packImageName
                          __typename
                        }
                        setIds {
                          setPrice
                          __typename
                        }
                        __typename
                      }
                      __typename
                    }
                    __typename
                  }
                  __typename
                }
                __typename
              }
            }

          """;

  final vble = {
    "deviceType": deviceType,
  };
  QueryResult result = await _client.query(QueryOptions(
    document: gql(retrieveLandingPageGql),
    variables: vble,
    fetchPolicy: FetchPolicy.networkOnly,
  ));
  // print(result.hasException);
  // print(result.exception);
  if (!result.hasException) {
    var categoryPack = result.data!['retrieveLandingPage'];

    if (categoryPack != null && categoryPack.length > 0) {
      retrieveLandingPageSettings = retrieveLandingPageJson(categoryPack);
    }
    return retrieveLandingPageSettings;
  }
  return retrieveLandingPageSettings;
}