encodeDataTableThemeData static method

Map<String, dynamic>? encodeDataTableThemeData(
  1. DataTableThemeData? value
)

Encodes the given value to a JSON representation.

{
  "columnSpacing": <double>,
  "dataRowColor": <MaterialStateProperty<Color>>,
  "dataRowHeight": <double>,
  "dataTextStyle": <TextStyle,
  "dividerThickness": <double>,
  "headingRowColor": <MaterialStateProperty<Color>>,
  "headingRowHeight": <double>,
  "headingTextStyle": <TextStyle>,
  "horizontalMargin": <double>
}

This won't maintain the MaterialStateProperty of each corresponding property, instead will resolve them by using an empty set of states, returning and encoding the resolved object.

See also:

Implementation

static Map<String, dynamic>? encodeDataTableThemeData(
    DataTableThemeData? value) {
  Map<String, dynamic>? result;

  if (value != null) {
    result = <String, dynamic>{
      'columnSpacing': value.columnSpacing,
      'dataRowColor': encodeMaterialStatePropertyColor(
        value.dataRowColor,
      ),
      'dataRowHeight': value.dataRowHeight,
      'dataTextStyle': encodeTextStyle(
        value.dataTextStyle,
      ),
      'dividerThickness': value.dividerThickness,
      'headingRowColor': encodeMaterialStatePropertyColor(
        value.headingRowColor,
      ),
      'headingRowHeight': value.headingRowHeight,
      'headingTextStyle': encodeTextStyle(
        value.headingTextStyle,
      ),
      'horizontalMargin': value.horizontalMargin,
    };
  }

  return _stripNull(result);
}