revertField method

dynamic revertField(
  1. dynamic f
)

Implementation

dynamic revertField(dynamic f){
  if(f==null)return null;
  if(f is Map){
    if(f.containsKey(consts.dataIdKey))return f[consts.dataIdKey];
    else return f.map((k, v) => MapEntry(revertField(k), revertField(v)));
  }else if(f is List){
    return f.map((e) => revertField(e)).toList();
  }else if(f is DateTime){
    return f.millisecondsSinceEpoch;
  }else return f;
}