shopify_storefront 0.0.3 copy "shopify_storefront: ^0.0.3" to clipboard
shopify_storefront: ^0.0.3 copied to clipboard

A Flutter package for Shopify Storefront API. This package helps to easily fetch products and other data using Shopify's StoreFront graphQL API

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:shopify_storefront/shopify_storefront.dart';

String query = "query {shop { name } }";

class Test extends StatefulWidget {
  const Test({super.key});

  @override
  State<Test> createState() => _TestState();
}

class _TestState extends State<Test> {
  void handleError(error) {
    /*
    String errorMessage = error.message ?? '';
    if (error is BadRequestException) {
      showToast(desc: errorMessage);
    } else if (error is FetchDataException) {
      showErrorDialog(desc: errorMessage);
    } else if (error is ApiNotRespondingException) {
      showErrorDialog(
        desc: 'It takes long to respond',
      );
    }
    */
  }

  @override
  Widget build(BuildContext context) {
    return FutureBuilder(
      future:
          ShopifyStoreFront('xgg85i66544852o7894byy6ii8546p9', 'esefire-wel')
              .fetchDataFromShopify(query, handleError),
      builder: (context, snapshot) => Text(snapshot.data ?? ''),
    );
  }
}
2
likes
160
points
14
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for Shopify Storefront API. This package helps to easily fetch products and other data using Shopify's StoreFront graphQL API

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http

More

Packages that depend on shopify_storefront