getCombinedParams method

Map<String, String> getCombinedParams(
  1. Map<String, String>? requestParams
)

merges custom request params into the the params here and returns a combined map of params, where custom params override default ones

Implementation

Map<String, String> getCombinedParams(Map<String, String>? requestParams) {
  final paramObj = params ?? {};

  // if no request params -> just return default params
  if (requestParams == null || requestParams.isEmpty) {
    return paramObj;
  }

  // create a new map for that
  Map<String, String> retMap = {};

  // otherwise return a combination of both
  retMap.addAll(paramObj);
  retMap.addAll(requestParams);

  return retMap;
}