toJson method
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({
'autofocus': false == autofocus ? null : autofocus,
'contentPadding': ThemeEncoder.encodeEdgeInsetsGeometry(
contentPadding,
),
'dense': dense,
'enableFeedback': enableFeedback,
'enabled': true == enabled ? null : enabled,
'focusColor': ThemeEncoder.encodeColor(
focusColor,
),
'focusNode': focusNode,
'horizontalTitleGap': horizontalTitleGap,
'hoverColor': ThemeEncoder.encodeColor(
hoverColor,
),
'iconColor': ThemeEncoder.encodeColor(
iconColor,
),
'isThreeLine': false == isThreeLine ? null : isThreeLine,
'leading': leading?.toJson(),
'leadingAndTrailingTextStyle': ThemeEncoder.encodeTextStyle(
leadingAndTrailingTextStyle,
),
'minLeadingWidth': minLeadingWidth,
'minTileHeight': minTileHeight,
'minVerticalPadding': minVerticalPadding,
'mouseCursor': ThemeEncoder.encodeMouseCursor(
mouseCursor,
),
'onFocusChange': onFocusChange,
'onLongPress': onLongPress,
'onTap': onTap,
'selected': false == selected ? null : selected,
'selectedColor': ThemeEncoder.encodeColor(
selectedColor,
),
'selectedTileColor': ThemeEncoder.encodeColor(
selectedTileColor,
),
'shape': ThemeEncoder.encodeShapeBorder(
shape,
),
'splashColor': ThemeEncoder.encodeColor(
splashColor,
),
'style': ThemeEncoder.encodeListTileStyle(
style,
),
'subtitle': subtitle?.toJson(),
'subtitleTextStyle': ThemeEncoder.encodeTextStyle(
subtitleTextStyle,
),
'textColor': ThemeEncoder.encodeColor(
textColor,
),
'tileColor': ThemeEncoder.encodeColor(
tileColor,
),
'title': title?.toJson(),
'titleAlignment': ThemeEncoder.encodeListTileTitleAlignment(
titleAlignment,
),
'titleTextStyle': ThemeEncoder.encodeTextStyle(
titleTextStyle,
),
'trailing': trailing?.toJson(),
'visualDensity': ThemeEncoder.encodeVisualDensity(
visualDensity,
),
...args,
});
}