> For the complete documentation index, see [llms.txt](https://docs.firework.com/firework-for-developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.firework.com/firework-for-developers/flutter-sdk/integration-guide-v2/shopping.md).

# Shopping (Flutter)

### Shopping configurations

Please refer to [Shopping configurations (Flutter)](/firework-for-developers/flutter-sdk/integration-guide-v2/customization/shopping-configurations-flutter.md).

### Customize shopping click behaviors

Please refer to [Customize shopping click behaviors](/firework-for-developers/flutter-sdk/integration-guide-v2/customization/customize-click-behaviors-flutter.md).

### **Product Hydration**

Host app can implement `onUpdateProductDetails` callback to update product info in the client side, such as product name. We call this product hydration. For example, the host apps could fetch the latest product information from their own servers on the callback and return the lastest product info in the callback. The code snippets are:

```dart
FireworkSDK.getInstance().shopping.onUpdateProductDetails =
    (UpdateProductDetailsEvent? event) async {
  if (event == null) {
    return null;
  }

  List<Product> products = [];
  for (var productId in event.productIds) {
    // Get the latest product info from the server, such as the host app server.
    final remoteProduct = await fetchProductFromServer(productId)
    final product = Product(
      productId: productId,
      name: remoteProduct.name, // Update the product name
      description: remoteProduct.description, // Update the product description
      units: remoteProduct.variants!.map((remoteProductVariant) {
            return ProductUnit(
              unitId: remoteProductVariant.id,
              url: remoteProductVariant.url, // Update product variant url
              imageUrl: remoteProductVariant.imageUrl, // Update product variant image url
              isAvailable: remoteProductVariant.isAvailable, // Update product variant availability
              price: ProductPrice(
                amount: remoteProductVariant.amount,
                currencyCode: remoteProductVariant.currencyCode,
              ), // Update product variant price
            );
          }).toList(),
    );

    products.add(product);
  }
  // The above example retrieves products one by one.
  // But if the server API allows bulk retrieval of product information,
  // you can also obtain remote product information in bulk.
  // Such as: final remoteProducts = await fetchProductsFromServer(event.productIds)

  return products;
};
```

### Reference

[VideoShopping](https://eng.firework.com/fw_flutter_sdk/v2/fw_flutter_sdk/VideoShopping-class.html)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.firework.com/firework-for-developers/flutter-sdk/integration-guide-v2/shopping.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
