toJson method

dynamic toJson()

Converts the current value to JSON.

This method assumes that the generic type T has a toJson method defined.

Implementation

dynamic toJson() =>
    switch (value) { Map map => map, var val => (val as dynamic).toJson() };