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() {
  return JsonClass.removeNull({
    'alignment': ThemeEncoder.encodeAlignment(
      alignment,
    ),
    'animations': animations,
    'antialiasing': antialiasing,
    'artboard': artboard,
    'asset': asset,
    'fit': ThemeEncoder.encodeBoxFit(
      fit,
    ),
    'package': package,
    'placeholder': placeholder?.toJson(),
    'rive': rive,
    'stateMachines': stateMachines,
    'url': url,
    ...args,
  });
}