anyValueToWriteableJson method

dynamic anyValueToWriteableJson(
  1. dynamic value
)

Implementation

dynamic anyValueToWriteableJson(dynamic value) {
  if (value is JsonScheme) {
    return value.toJson();
  } else if (value is List<JsonScheme>) {
    return value.toJson();
  } else if (value is DateTime) {
    return value.millisecondsSinceEpoch;
  } else if (value is Enum) {
    return value.name;
  } else if (value is List<Enum>) {
    return value.map((e) => e.name).toList();
  } else if (value is Uri) {
    return value.toString();
  } else {
    return value;
  }
}