Transport / packaging further json information.
Hi.
I am operating on a wrapper library round some json information. (It offers you great categories to make operating with json simple and handy).
Is there a approach to package deal those json information with my library so they’re to be had at the runtime regardless of the place my lib used?
From what I discovered the one means is downloading them on the runtime if lacking, however I need to be certain that there is no higher manner.
I am hoping you’ll be able to perceive what I imply.
Thank you
Edit: Large thank you for the entire solutions, I did not anticipated that a lot assist on this couple of minutes.
I will be able to use some more or less code technology as you recommended. Recently I am not positive wchich package deal I will be able to use, or perhaps I will be able to make my very own generator, however codegen is without a doubt easy methods to move.
Perhaps I will be able to additionally make any other edut with the general determination, after imposing it for different individuals who will in finding this put up.
Edit2: First I attempted the usage of the pack software from dcli package deal and It might determine completely however… I came upon that my information are round 70 MB in dimension, and packing them bumps the scale to 100 MB (through base64 encoding them).
Answer: So without a gear that might fulfill my necessities I stopped up writing my very own one. It is in point of fact easy and mainly it grabs the entire information and for each and every one it we:
1. Learn the document as bytes
2. Compress it the usage of gzip (dart has integrated fortify for this codec)
3. Base64 encode to show bytes right into a string.
4. Put the string right into a map the place the hot button is the trail to the document.
Then we flip the map right into a json string, break out it and put it in a dart document.
And right here we move, with the compression we get a 4mb document, a a lot better dimension.
After which on the runtime:
Decode the string again into map, decode and decompress the information and now we have a Map<PathToFile, FileInBytes>, that we will use for one thing.
Hope this is helping 🙂
View Reddit through Burzowy-Szczurek – View Supply