toJson method

List toJson({
  1. List<String>? include,
  2. bool onlyValues = false,
})

Implementation

List toJson({List<String>? include, bool onlyValues = false}) {
  return map((e) {
    Map<String, dynamic> json = e.toJson();
    if (include != null) {
      json.removeWhere((key, value) => !include.contains(key));
    }
    return onlyValues ? json.values.toList() : json;
  }).toList();
}