UConvert class abstract
Data format conversions in pure Dart: JSON pretty/minify, JSON⇄XML, JSON⇄CSV, Map⇄query string. UConvert.prettyJson(body)
Constructors
- UConvert()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
csvToJson(
String csv, {String delimiter = ",", bool pretty = false}) → String - CSV with a header row → JSON array of objects (quotes and newlines handled).
-
decodeJson(
String json) → dynamic - JSON text → Map/List/value.
-
encodeJson(
Object? value, {bool pretty = false, int indent = 2}) → String -
Any value → JSON text, optionally pretty.
UConvert.encodeJson(map, pretty: true) -
jsonToCsv(
String json, {String delimiter = ","}) → String -
JSON array of flat objects → CSV with a header row.
UConvert.jsonToCsv(jsonEncode(rows)) -
jsonToXml(
String json, {String rootName = "root", bool pretty = true}) → String -
JSON text → XML under
rootName.UConvert.jsonToXml('{"a":1}') -
mapToQueryString(
Map< String, dynamic> map) → String -
Map → "a=1&b=x%20y".
UConvert.mapToQueryString({"q": "hi"}) -
minifyJson(
String json) → String - Removes all whitespace from JSON text.
-
prettyJson(
String json, {int indent = 2}) → String -
Re-indents JSON text for display.
UConvert.prettyJson('{"a":1}') -
queryStringToMap(
String query) → Map< String, String> - "?a=1&b=2" → {"a": "1", "b": "2"}.
-
valueToXml(
Object? value, {String rootName = "root", bool pretty = true}) → String - Any Dart value → XML.
-
xmlToJson(
String xml, {bool pretty = false, bool includeRoot = true}) → String - XML text → JSON text (attributes become "@name", repeated tags become lists).