toString method

  1. @override
String toString()
override

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.

Implementation

@override
String toString() {
  final mode = theme?.isDarkMode == true ? 'dark' : 'light';
  final themeData = theme?.themeData ?? ReownAppKitModalThemeData();
  late ReownAppKitModalColors colors;
  if (mode == 'dark') {
    colors = themeData.darkColors;
  } else {
    colors = themeData.lightColors;
  }

  final tm = 'themeMode:"$mode"';

  final mix = RenderUtils.colorToRGBA(colors.background125);
  final tv1 = '"--w3m-color-mix":"$mix"';
  // final tv2 = '"--w3m-color-mix-strength":"0%"';
  final tv = 'themeVariables:{$tv1}';

  final accent = RenderUtils.colorToRGBA(colors.accent100);
  final wtv1 = '"--w3m-accent":"$accent"';
  final background = RenderUtils.colorToRGBA(colors.background125);
  final wtv2 = '"--w3m-background":"$background"';
  final w3mtv = 'w3mThemeVariables:{$wtv1,$wtv2}';

  return '{type:"${super.type}",payload:{$tm, $tv,$w3mtv}}';
}