class UrlUtils {
  UrlUtils._();

  static String buildQueryString(Map<String, dynamic>? params) {
    if (params == null || params.isEmpty) return '';

    final queryParams = <String, String>{};
    for (final entry in params.entries) {
      final value = entry.value;
      if (value == null) continue;
      if (value is String || value is num || value is bool) {
        queryParams[entry.key] = value.toString();
      }
    }

    if (queryParams.isEmpty) return '';
    return '?${Uri(queryParameters: queryParams).query}';
  }
}
