toJson method

  1. @override
dynamic toJson()
override

toJson returns a json compatible object.

Descendants must override this method to expose custom properties.

Implementation

@override
toJson() {
  return super.toJson()..addAll(<String, dynamic>{
    if (alignment != null) 'alignment': alignment!.toJson(),
    if (padding != null) 'padding': padding!.toJson(),
    if (color != null) 'color': color!.toJson(),
    if (decoration != null) 'decoration': decoration!.toJson(),
    if (foregroundDecoration != null)
      'foregroundDecoration': foregroundDecoration!.toJson(),
    'width': ?width,
    'height': ?height,
    if (constraints != null) 'constraints': constraints!.toJson(),
    if (margin != null) 'margin': margin!.toJson(),
    if (transform != null) 'transform': transform!.toJson(),
    if (transformAlignment != null)
      'transformAlignment': transformAlignment!.toJson(),
    'clipBehavior': clipBehavior.name,
    if (child != null) 'child': child!.toJson(),
  });
}