toJson method

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

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() {
  return JsonClass.removeNull({
    'backgroundColor': ThemeEncoder.instance.encodeColor(backgroundColor),
    'borderRadius': ThemeEncoder.instance.encodeBorderRadiusGeometry(
      borderRadius,
    ),
    'color': ThemeEncoder.instance.encodeColor(color),
    'minHeight': minHeight,
    'semanticsLabel': semanticsLabel,
    'semanticsValue': semanticsValue,
    'stopIndicatorColor': ThemeEncoder.instance.encodeColor(
      stopIndicatorColor,
    ),
    'stopIndicatorRadius': stopIndicatorRadius,
    'trackGap': trackGap,
    'value': value,
    'valueColor': valueColor,
    'year2023': year2023,

    ...args,
  });
}