@@ -12,11 +12,11 @@ import 'nodes/nodes.dart';
1212/// nothing.
1313bool excludeConstraintsIf (BaseNode node) =>
1414 (node.constraints.minHeight == null || node.constraints.minHeight == 0 ) &&
15- (node.constraints.minWidth == null || node.constraints.minWidth == 0 ) &&
16- (node.constraints.maxHeight == null ||
17- node.constraints.maxHeight == double .infinity) &&
18- (node.constraints.maxWidth == null ||
19- node.constraints.maxWidth == double .infinity);
15+ (node.constraints.minWidth == null || node.constraints.minWidth == 0 ) &&
16+ (node.constraints.maxHeight == null ||
17+ node.constraints.maxHeight == double .infinity) &&
18+ (node.constraints.maxWidth == null ||
19+ node.constraints.maxWidth == double .infinity);
2020
2121/// Excludes [EdgePinsModel] from the json if it's technically doing nothing.
2222bool excludeEdgePinsIf (BaseNode node) {
@@ -1088,21 +1088,18 @@ mixin PortalMixin on BaseNode {
10881088/// Type casts rotation value to integer.
10891089int castRotation (dynamic v) => (v as num ? )? .toInt () ?? 0 ;
10901090
1091- /// This mixin is extended by every Undo Action and api models, so [toJson] can
1092- /// be called regardless of the class.
1093- /// It is used for storing actions on server.
1094- mixin SerializableMixin {
1091+ /// Base mixin for providing [toJson] method to every class for
1092+ /// JSON serialization.
1093+ mixin BaseSerializableMixin <T > {
10951094 /// Returns a serializable map representation of the object.
1096- Map toJson ();
1095+ T toJson ();
10971096}
10981097
1099- /// This mixin is extended by every Undo Action and api models, so [toJson] can
1100- /// be called regardless of the class.
1101- /// It is used for storing actions on server.
1102- mixin DynamicSerializableMixin {
1103- /// Returns a serializable dynamic representation of the object.
1104- dynamic toJson ();
1105- }
1098+ /// A mixin typedef that serializes class to a [Map] .
1099+ typedef SerializableMixin = BaseSerializableMixin <Map >;
1100+
1101+ /// A mixin typedef that serializes class to a dynamic.
1102+ typedef DynamicSerializableMixin = BaseSerializableMixin <dynamic >;
11061103
11071104/// A mixin that adds the ability to add conditions to a node.
11081105mixin ConditionsMixin {
0 commit comments