getShapeById method

Shape? getShapeById(
  1. int id
)

@todo Make a faster map

Implementation

Shape? getShapeById(int id){
  final bodies = this.bodies;
  for (int i = 0; i < bodies.length; i++) {
    final shapes = bodies[i].shapes;
    for (int j = 0; j < shapes.length; j++) {
      final shape = shapes[j];
      if (shape.id == id) {
        return shape;
      }
    }
  }

  return null;
}