listAllPrices method

Future<Map> listAllPrices(
  1. String? variantId
)

List all stores

Returns a paginated list of stores.

Implementation

Future<Map> listAllPrices(String? variantId) async {
  if (apiKey.isEmpty) {
    return {'error': 'API key is empty'};
  }
  Options dioOptions = Options(headers: {
    "Authorization ": "Bearer $apiKey",
    "Accept": "application/vnd.api+json",
    "Content-Type": "application/vnd.api+json"
  });

  if (variantId != null) {
    try {
      Response response = await dio.get(
        "https://api.lemonsqueezy.com/v1/prices?filter[variant_id]=$variantId",
        options: dioOptions,
      );

      return response.data;
    } catch (e) {
      return {'error': e.toString()};
    }
  } else {
    try {
      Response response = await dio.get(
        "https://api.lemonsqueezy.com/v1/prices",
        options: dioOptions,
      );

      return response.data;
    } catch (e) {
      return {'error': e.toString()};
    }
  }
}