Pose.fromMap constructor

Pose.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory Pose.fromMap(Map<String, dynamic> map) {
  /// gets double values from Float list
  List<double> fromFloats(v) =>
      (v as List<Float>).map((f) => f.value).toList();

  return Pose(
    head: map.containsKey('Head') ? fromFloats(map['Head']) : [],
    body: map.containsKey('Body') ? fromFloats(map['Body']) : [],
    lleg: map.containsKey('LeftLeg') ? fromFloats(map['LeftLeg']) : [],
    rleg: map.containsKey('RightLeg') ? fromFloats(map['RightLeg']) : [],
    larm: map.containsKey('LeftArm') ? fromFloats(map['LeftArm']) : [],
    rarm: map.containsKey('RightArm') ? fromFloats(map['RightArm']) : [],
  );
}