toJson method

  1. @override
Map<String, dynamic> toJson()

Abstract function that concrete classes must implement. This must encode the internal data model to a JSON compatible representation.

While not required, it is suggested to call removeNull before returning.

Implementation

@override
Map<String, dynamic> toJson() => {
      'color': color?.hexString,
      'domain': domain.toString(),
      'domainLowerBound': domainLowerBound?.toString(),
      'domainUpperBound': domainUpperBound?.toString(),
      'fillColor': fillColor?.hexString,
      'label': label,
      'measure': measure,
      'measureLowerBound': measureLowerBound,
      'measureUpperBound': measureUpperBound,
      'radius': radius,
      'shape': shape,
      'strokeWidth': strokeWidth,
    };