I'm trying to convert a Map to a human readable string.
So let's say I have this Map:
Map<String, String> map = { "foo": "lorem", "bar": "ipsum" };
I want to convert it too the following string, including the indents:
{
"foo": "lorem",
"bar": "ipsum"
}
use: new JsonEncoder.withIndent(" ").convert(map)
see at dartpad: https://dartpad.dartlang.org/685e0fc43fb4e70c602e
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With