musicAffinityTypeList function

Future<List<MusicAffinityModel>> musicAffinityTypeList(
  1. {bool showLoader = true}
)

Implementation

Future<List<MusicAffinityModel>> musicAffinityTypeList({bool showLoader = true}) async {
  if (showLoader) appStore.setLoading(true);
  String userId = appStore.isLoggedIn && appStore.userId.validate() > 0 ? "?user_id=${appStore.userId}" : '';

  try {
    var res = MusicTypeListResponse.fromMap(await (handleResponse(await buildHttpResponse("${APIEndPoint.musicTypeList}$userId", method: HttpMethod.GET))));
    if (showLoader) appStore.setLoading(false);
    return res.data!.data.validate();
  } catch (e) {
    appStore.setLoading(false);
    throw errorSomethingWentWrong;
  }
}