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() {
  final iconEncoded = _JsonIoniconBuilder._encodeIcon(icon);

  return JsonClass.removeNull({
    'applyTextScaling': applyTextScaling,
    'color': ThemeEncoder.encodeColor(
      color,
    ),
    'fill': fill,
    'grade': grade,
    'icon': iconEncoded,
    'opticalSize': opticalSize,
    'semanticLabel': semanticLabel,
    'shadows': shadows,
    'size': size,
    'textDirection': ThemeEncoder.encodeTextDirection(
      textDirection,
    ),
    'weight': weight,
    ...args,
  });
}