toMap method

Map<String, dynamic> toMap({
  1. EnumMethod? enumMethod,
})

Converts instance to a map.

Implementation

Map<String, dynamic> toMap({EnumMethod? enumMethod}) {
  return {
    "backgroundColor": backgroundColor?.toHex(),
    "baselineOffset": baselineOffset,
    "expansion": expansion,
    "foregroundColor": foregroundColor?.toHex(),
    "kern": kern,
    "ligature": ligature,
    "obliqueness": obliqueness,
    "strikethroughColor": strikethroughColor?.toHex(),
    "strikethroughStyle": switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => strikethroughStyle?.toNativeValue(),
      EnumMethod.value => strikethroughStyle?.toValue(),
      EnumMethod.name => strikethroughStyle?.name(),
    },
    "string": string,
    "strokeColor": strokeColor?.toHex(),
    "strokeWidth": strokeWidth,
    "textEffect": switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => textEffect?.toNativeValue(),
      EnumMethod.value => textEffect?.toValue(),
      EnumMethod.name => textEffect?.name(),
    },
    "underlineColor": underlineColor?.toHex(),
    "underlineStyle": switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => underlineStyle?.toNativeValue(),
      EnumMethod.value => underlineStyle?.toValue(),
      EnumMethod.name => underlineStyle?.name(),
    },
  };
}