fromJson static method
Either shape of toJson. Throws on a missing key, a wall that is not
a handle, or an unknown side name, as 07's justification does. Any
k int is accepted, and any coordinate (R-3): a k outside {0, 1} or
a non-finite coordinate is dimension.broken (D15), and generates
nothing (D7).
Implementation
static DimEnd fromJson(Map<String, Object?> json) {
if (json['point'] case final List<Object?> p) {
return FixedEnd((p[0]! as num).toDouble(), (p[1]! as num).toDouble());
}
return AttachedEnd(Handle.fromJson(json['wall']), json['k']! as int,
WallSide.values.byName(json['side']! as String));
}