Question

I've run into a similar situation to this chap where I'd like to have dart:io and dart:html in the same application. I know that dart:io is a server-side library and dart:html is a client side. My situation is as follows. I have a program to outputs a huge amount of text to a log file. I've found Dart to be great at text manipulation. I wanted to take the log file text, manipulate it, put some information in headed textareas for readability etc., and view the page.

I have no intentions to put this on the web. It's just for my work computer. I just want the file loading capabilities of dart:io and the nice display of dart:html. The previous post was in April and development on Dart is speedy. Is there now another way of doing what I want?

I know I could write a program to build a HTML file with the manipulated text in the appropriate fields and then open that HTML file but I don't like that idea as much. Is there another way?

Was it helpful?

Solution

You may consider using this library html5lib on server side apps to generate HTML output. Then it's simply a matter of opening the file up in a browser. This can also be automated by calling starting a Process which launches the browser and points to your generated html file.

html5lib is still a work in progress, but I'm sure they would like to hear your feedback.

OTHER TIPS

I do agree that if all you want to do is to create a static web page, then using a lib like html5lib may be the best. However, if you like to do something more I think the way to go is to think of the server side dart as the model and the client side as the "rest". What the rest is depends mostly on if you like MVC, MVP, ...

I have been close to develop a desktop app in dart but I still haven't found an interesting enough example to get me going. I have been thinking of how I would do it though, and I believe that by connecting the two sides (model and "the rest") with a web socket, a make a simple serialization protocol (e.g. json), you can easily create an rpc with a client side wrapper using noSuchMethod() as the proxy and on the server side you use mirrors. You can create callbacks the other way if you like using the web socket. I believe Gilad mentioned a similar rpc technique between isolates in his talk from the HTML5 Dev Conf.

Anyway, what you would get is both dart:io and dart:html in the same "app", but the app would consist of a server side and a client side. This is what I will try for my next desktop app, whatever that will be :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top