fetchSubBrandId function

Future<String> fetchSubBrandId(
  1. String brandId
)

Implementation

Future<String> fetchSubBrandId(String brandId) async {
  String url = 'https://api.lakme.mirrar.com/brand/beauty/id-login';
  Map<String, String> requestBody = {
    'brand_id': brandId,
  };
  try {
    var response =
        await http.post(Uri.parse(url), body: jsonEncode(requestBody));

    if (response.statusCode == 200) {
      var responseData = response.body;
      // Process the responseData here
      return responseData;
    } else {
      print('Request failed with status: ${response.statusCode}');
      throw Exception('API call failed with status: ${response.statusCode}');
    }
  } catch (error) {
    throw Exception('API call failed with status: $error');
  }
}