getSearchResultType function

String? getSearchResultType(
  1. String? resultTypeLocal,
  2. List<String> resultTypesLocal
)

Get type of the search result.

Implementation

String? getSearchResultType(
  String? resultTypeLocal,
  List<String> resultTypesLocal,
) {
  if (resultTypeLocal == null || resultTypeLocal.isEmpty) return null;

  final lowerType = resultTypeLocal.toLowerCase();
  String resultType;

  if (!resultTypesLocal.contains(lowerType)) {
    resultType = 'album';
  } else {
    resultType = ALL_RESULT_TYPES[resultTypesLocal.indexOf(lowerType)];
  }

  return resultType;
}