updateBillingAddress method

Future<bool> updateBillingAddress(
  1. UpdateBillingAddressRequestModel userAddressModel
)

Implementation

Future<bool> updateBillingAddress(
    UpdateBillingAddressRequestModel userAddressModel) async {
  String addUserGql = """mutation updateBillingAddress(
              \$id: String
              \$addressId: String
              \$addressInput: AddressInput
            ) {
              updateBillingAddress(
                id: \$id
                addressId: \$addressId
                addressInput:\$addressInput
              ) {
                _id
                __typename
              }
            }""";
  GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration();
  GraphQLClient _client = graphQLConfiguration.clientToQuery();
  final vble = {
    "addressId": userAddressModel.addressId,
    "addressInput": userAddressModel.addressInput,
    "id": userAddressModel.sId
  };
  QueryResult result = await _client.mutate(
    MutationOptions(
      document: gql(addUserGql),
      variables: vble,
    ),
  );
  if (!result.hasException) {
    var updateBillingAddress = result.data!['updateBillingAddress'];
    if (updateBillingAddress != null && updateBillingAddress["_id"] != null) {
      return true;
    } else {
      return true;
    }
  }
  return false;
}