fromDict static method

Sp3dPhysics fromDict(
  1. Map<String, dynamic> src
)

Restore this object from the dictionary.

  • src : A dictionary made with toDict of this class.

Implementation

static Sp3dPhysics fromDict(Map<String, dynamic> src) {
  // after version 4
  String? mName;
  if (src.containsKey('name')) {
    mName = src['name'];
  }
  return Sp3dPhysics(
      isLocked: src['is_locked'],
      mass: src['mass'],
      speed: src['speed'],
      direction: src['direction'] != null
          ? Sp3dV3D.fromDict(src['direction'])
          : null,
      velocity:
          src['velocity'] != null ? Sp3dV3D.fromDict(src['velocity']) : null,
      rotateAxis: src['rotate_axis'] != null
          ? Sp3dV3D.fromDict(src['rotate_axis'])
          : null,
      angularVelocity: src['angular_velocity'],
      angle: src['angle'],
      name: mName,
      others: src['others']);
}