from static method

ToolValue from(
  1. dynamic value
)

Create from any JSON-compatible value

Implementation

static ToolValue from(dynamic value) => switch (value) {
      null => const NullToolValue(),
      String s => StringToolValue(s),
      num n => NumberToolValue(n.toDouble()),
      bool b => BoolToolValue(b),
      List l => ArrayToolValue(l.map(from).toList()),
      Map m => ObjectToolValue(m.map((k, v) => MapEntry(k.toString(), from(v)))),
      _ => StringToolValue(value.toString()),
    };