getHairStyles function

Future<String> getHairStyles(
  1. String brandID,
  2. String subBrandID
)

Implementation

Future<String> getHairStyles(String brandID, String subBrandID) async {
  var url = Uri.parse(
      'https://api.lakme.mirrar.com/hairstylecolor/hairType/all/brand/$brandID/subBrandId/$subBrandID');

  try {
    var response = await http.get(url);

    if (response.statusCode == 200) {
      // API call successful, you can handle the response here
      print(response.body);
      return response.body;
    } else {
      // API call failed, handle the error
      print('API request failed with status code: ${response.statusCode}');
      throw Exception('API call failed with status: ${response.statusCode}');
    }
  } catch (error) {
    // Exception occurred during API call
    print('API request failed with error: $error');
    throw Exception('API call failed with status: $error');
  }
}