filterByKeys<T, K> method

Map<T, K> filterByKeys<T, K>(
  1. List<String> keys, {
  2. bool isAllowValueNull = true,
})

Implementation

Map<T, K> filterByKeys<T, K>(List<String> keys,
    {bool isAllowValueNull = true}) {
  Map<T, K> jsonData = {};
  forEach((key, value) {
    if (keys.contains(key)) {
      if (isAllowValueNull) {
        jsonData[key] = value;
      } else {
        if (value != null) {
          jsonData[key] = value;
        }
      }
    }
  });
  return jsonData;
}