INNER CODE UNIT · Dart
toJson
hackware1993/Flutter_ConstraintLayout · lib/src/auxiliary.dart:512
Map<String, dynamic> toJson(ConstrainedNode node) {
final map = <String, dynamic>{};
if (node.nodeId == parent) {
map['nodeId'] = 'parent';
} else {
map['nodeId'] = node.nodeId.id;
if (node.leftConstraint != null) {
if (node.leftAlignType == ConstraintAlignType.left) {
map['leftAlignType'] = 'toLeft';
} else if (node.leftAlignType == ConstraintAlignType.center) {
map['leftAlignType'] = 'toCenter';
} else {
map['leftAlignType'] = 'toRight';
}
if (node.leftConstraint!.isParent()) {
map['leftConstraint'] = 'parent';
} else {
map['leftConstraint'] = toJson(node.leftConstraint!);