For my application I have some more complex structures in which there is a map that has nested maps (and sometimes even nested lists in side of them).
Just creating a Dart map with all the data and calling encoder.writeMap doesn't work (throws an exception, because the nested map/list isn't being handled nicely).
I figured I could work around this by calling encoder.writeMap with the map that has the "simple" stuff in it, setting indefinite to false and passing the total number of elements to length.
The first byte it generates shows the correct length, but somehow the calls I do to the encoder afterwards are not taken into account.
Calls I do afterwards include encoder.writeString (to write the key) and encoder.writeMap (to write the nested map).
There is not much documentation on how these more complex types should be handled and I was hoping this would be a solution.
Can someone elaborate on how this should be done (or tell me if I'm missing a call or something)?
For my application I have some more complex structures in which there is a map that has nested maps (and sometimes even nested lists in side of them). Just creating a Dart map with all the data and calling
encoder.writeMap
doesn't work (throws an exception, because the nested map/list isn't being handled nicely).I figured I could work around this by calling
encoder.writeMap
with the map that has the "simple" stuff in it, settingindefinite
tofalse
and passing the total number of elements tolength
. The first byte it generates shows the correct length, but somehow the calls I do to the encoder afterwards are not taken into account. Calls I do afterwards includeencoder.writeString
(to write the key) andencoder.writeMap
(to write the nested map).There is not much documentation on how these more complex types should be handled and I was hoping this would be a solution. Can someone elaborate on how this should be done (or tell me if I'm missing a call or something)?