buildValue method
Builds a TomlValue for the given value
or throws a
TomlUnknownValueTypeException if the value cannot be represented by
TOML.
Implementation
TomlValue buildValue(dynamic value) {
value = unwrapValue(value);
if (value is int) return TomlInteger.dec(BigInt.from(value));
if (value is BigInt) return TomlInteger.dec(value);
if (value is double) return TomlFloat(value);
if (value is bool) return TomlBoolean(value);
if (value is DateTime) return TomlOffsetDateTime.fromDateTime(value);
if (value is String) return buildString(value);
if (value is Iterable) return buildArray(value);
if (value is Map) return buildInlineTable(value);
if (value is TomlValue) return value;
throw TomlUnknownValueTypeException(value);
}