toJsonOver method

Json toJsonOver(
  1. Spring base
)

toJson without what base (the owner's default) already says: a physical spring over a physical default writes only the constants that differ ({"stiffness": 200}), as fromJson reads them back.

Implementation

Json toJsonOver(Spring base) {
  if (!isPhysical || !base.isPhysical) return toJson();
  return <String, Object?>{}
    ..d('stiffness', stiffness!, base.stiffness!)
    ..d('damping', damping!, base.damping!)
    ..d('mass', mass, base.mass);
}