使用json.encode
时如何忽略键?
类似这样的东西:
final map = json.decode(json.encode(routine), reviver: (key, value) {
if (key == "id") {
return null;
}
return value;
});
但是通过这种方式,我的地图具有值为id
的键null
。我希望我的地图没有ID键。
任何想法?
routine.remove("id");
final map = json.decode(json.encode(routine));