dart - How to read file from an imported library -


i have 2 packages: webserver , utils provides assets webserver.

the webserver needs access static files inside utils. have setup:

utils/   lib/     static.html 

how can access static.html file in 1 of dart scripts in webserver?

edit: tried far, use mirrors path of library, , read there. problem approach is, if utils included package:, url returned currentmirrorsystem().findlibrary(#utils).uri package uri, can't transformed actual file entity.

use resource class, new class in dart sdk 1.12.

usage example:

var resource = new resource('package:myapp/myfile.txt'); var contents = await resource.loadasstring(); print(contents); 

this works on vm, of 1.12.

however, doesn't directly address need actual file entity, package: uri. given resource class today, you'd have route bytes loadasstring() http server's response object.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -