Dartlang support

Can Safe work dartlang? With dart:io (this is the server component of dartlang) rather than node.js? How would someone accomplish this? Has anyone else out there created API bindings for dart?

Here is the dartlang website https://www.dartlang.org/.

Do you mean https://api.dartlang.org/stable/2.1.0/dart-io/dart-io-library.html

The “dart . io” site does not come up for me.

yes dart:io is the one. Generally speaking, im just referring to a server running on dart.

1 Like

My organization has recently converted to developing solely in Dart, I think with clear Dart support, SAFE Network could expand a lot. Because Dart requires one language for everything (front end, backend, design), I think it has a lot of advantages over electron. With dart support in Safe network, people could program flutter apps that require almost no effort to integrate. Finally, (i beleive) using node.js is just less secure and slower than using dart server.

1 Like

@tomguim I didn’t know about Dart. If you have the time, maybe you could introduce it to us?

Your link isn’t working (you can fix that if you edit the post). I found this link https://www.dartlang.org/ which seems a good starting point but I don’t have time to dig into it.

It would be interesting to learn about the features of Dart, tools etc, and how it compares to nodejs and electron. We’re always open to new things here. Thanks for posting about it.

1 Like

Sure thing!
Google developed dart for what it envisions to be the replacement javascript (I share this belief).
So for starters Dart basically just javascript without the securtiy flaws, and much much faster (currently a little and i mean little slower than java. Speed is also sure to improve and I think will become faster).
It has amazing async support, and has server side front end and design all built into it. 1 Language for anything you could want to program, with the speed of java, the flexibility of javascript, and security that beats both. (Also personally I find it amazing that Dart can use objectDB, which is literally the fastest database that exists the database you use obviously differs per application but it is just worth noting that javascript does not support objectdb while dart can support it and all other popular options) Code is minimal and incredibly easy to write, it is like java but easier, things are just intuitive. It also has a different VM engine, BUT you can compile the code into the v8 javascript engine, and in cases where the language is not supported natively it will convert to javascript and run that.

Dart comes loaded with a ton of amazing tools.
ub package manager ( pub )

Manages Dart packages, making it easy for you to install, use, and share Dart libraries, command-line tools, and other assets. Some Dart technologies, such as Flutter, may not support all of the pub commands. IDEs that support Dart generally have special support for pub, but you can also use it from the command line.
Pub is a secure version of npm solving many node.js problems with security.

Static analyzer ( dartanalyzer )

Evaluates and reports any errors or warnings in your code. The Dart plugin for your IDE should make use of Dart’s analysis engine, but you can also run the analyzer from the command line.
Among my favorite features, this tool saves so many hours in the development of a program and makes an already extremely intuitive language, much more so.

Code formatter ( dartfmt )

Formats your code, following the recommendations of the Dart Style Guide. IDEs that support Dart generally allow you to format the code within the IDE. Or you can run the formatter from the command line.
This makes it super easy to standardize code and make it human readable

So i have outlined the basics of how it compares to node.js, here is how it compares to electron:
Flutter is a lot like Electron, but faster. Also, arguably easier to use. They don’t have to support all of the backward compability garbage that HTML/js has.

I don’t care much about Google but they did pretty good job with Flutter:

  1. No special designer needed, you do everything in code. That means everyone can use their preferred editor.

  2. Hot reload - you change something and it changes in the running app.

  3. Headless testing - No need to own iOS/Android device to test iOS/Android UI.

  4. Nice tooling - autocompletion, formatting, etc. Everything done via command line, with optional support for IDE.

  5. Extensible - very easy to write your own widgets. There is nothing special about provided components.

  6. Platform agnostic - “native look” of Qt/GTK is a lie, they still look off. To me it just triggers uncanny valley vibe. Not to mention that they implement native look from 5 years ago or more. And completely useless on mobiles. Flutter looks the same on every platform unless specified otherwise. Way less platform specific bugs.

You can find more on flutter here: flutter.io

I can not say that I am even a relatively good programmer, but I have used electron, flutter, and have developed in java. I can confidently say I have never used something so easy, intuitive, fast, and out of the box beautiful.

While right now the most popular method of creating a website with dart is through AngularDart, soon (this was announced at the most recent release) they will allow for development of web apps with flutter. (You can already do this to an extent).

In summary: Dart is as fast as Java and faster than Javascript, more secure than both, utilizes one unified language for all coding (front end and back end), is faster than node.js and more secure, has an electron equivalent called “flutter” which is just faster, more consistent and all typed under one language. Finally, it is by far the easiest programming language to develop in (In my opinion).

That’s a pretty general idea.


Thanks @tomguim, that’s a really good intro and shows your enthusiasm. :slight_smile:

Hope for us all here. Once you get to know nodejs it is very productive, but the variety of tools and options is confusing and creates a barrier to learning.

As with anything new, that creates its own difficulties of course, such as lack of native support as you mention, switching IDEs etc but Dart is clearly something we can look at and I hope some will have a go.

One area I’m curious about is how easy it will be to adapt for no-backend style apps, which is really what SAFE is good for, having eliminated the traditional server. That might be straightforward if the tools and libraries are modular, or difficult if they assume close integration between client and server.

Also, it may be useful to be able to mix with JavaScript where Dart libraries are lacking until it catches up - do you know of that is supported?

Do you know how this fits with or supports Progressive Web Apps which Google are keen on? PWA seems to be aimed at similar capabilities to offline-first / no-backend apps, which are a good fit for SAFE, but I haven’t delved into the tools or libraries to see how well they work with SAFE in practice. Do you have any thoughts on this?

Also, what kind of things are you using Dart to build? Are there things you’d like to build on SAFE yourself? Sorry for all the questions!

I’ve spent most of my time adapting other people’s apps for SAFE and haven’t built a Web app or website from scratch in a long time, so I’m behind in many areas. If I was building something from scratch for SAFE I wouldn’t know where to start in terms of frameworks and tools. I’d want to do a fair bit of study and evaluation first or get some advice.

Another thought. Google are known for creating cool stuff generating lots of interest and users and then walking away from it. So is all this open source, and what’s the status of the Dart ecosystem outside Google? No need to answer all these questions BTW, I’m just asking :slight_smile:

1 Like


Yea I was pretty familiar with node.js, and can attest that dart is in my opinion much much better.
As for IDE’s, there isn’t a need to switch.As for native support, browsers will eventually support it, and even if it doesn’t support it, dart2js (a package) will covert the code to javascript so the code can run regardless of the support for dart.

Completely possible, they do not assume close integration between client and sever, instead it is incredibly easy to integrate a close relationship and to do it all within the same language with incredibly security and speed. Tools and libraries with dart are modular (using “pub” instead of “npm”), but the core libaries of Dart are even better defined than those of javascript.

Yes, as a note the dart libraries are very well developed and (in terms of core libraries and sdks) already surpassed javascript. Javascript of course has more packages from the community (which is a downside but does not matter as much because in the case of javascript such packages are used to supplement failures of the core libraries, where as in Dart the core library is very well defined and dart packages supplement ability. So comparing the quantity of packages are little misleading)

There are several tools available, dart2js, node_io, node_preamble, node_interop. Dart does (dart -> JS) very well. Dart does not do JS -> dart very well yet although it is possible) but again the use of JS packages in dart is not really necessary because most dart alternatives exist and the javascript versions tend to be worse.

I can’t say that I am familiar with PWA, however based on your description it fits perfectly with PWA. Google invests heavily in its development. Offline first / no backend applications are really easy and simple too (imagine the entire application in just one short file). Part of the reason I brought dart up was because I think it fits perfectly with the architecture of Safe, it could only stand to make the network faster more secure and simpler.

I run an NGO that is implimenting a new economic model in developing countries (not a crypto or anything, but just a new economic model) you can check us out at github.com/mezounion it will consist of a server side app and database (orbitDB with Dart) all running on the safe network, which then communicate with the mobile app and web app using dart:io. We currently are just communicating between the server and the apps with dart:io but the hope is that we could put this protocol on safe network, which would be great in remote locations in Africa, south america, southern asia, and eastern europe where there is no internet connection and a distributed server system would be very good.

I’ve managed to run and develop the tutorial safe apps, and I have had some success with integrating Dart without even using the web api.

Google has been working on this for a while, and the user base for dart has continuously grown. The dart ecosystem is becoming very popular and I can only envision it becoming more so. And yes the language is open source!

My pleasure :smile:


Thanks for answering so many questions, your answers are very helpful and have piqued my interest. I don’t have time to look at this myself for the time being, but I hope you and others will take this further so we can see how useful this can be.

If you can, please say more about what you did and what’s next! Thanks again.

PS just exploring Mezo Union. It looks impressive and very interesting - good luck with it! Going a bit off topic here, but scanning your constitution I wonder if you’ve read Richard Bartlett’s proposal for microsolidarity? I read this recently and think he has done interesting and sensible ideas about people organising together, supporting each other, and avoiding some of the pitfalls we often see with movements and intentional communities. See: https://medium.com/enspiral-tales/courage-before-hope-a-proposal-to-weave-emotional-and-economic-microsolidarity-87bc81372a09

1 Like

Well in my attempts to run my dart application within safe browser, The site rendered completely and was fully functional WITHOUT the use of dart2js (that thing that converts dart code to javascript when it is not supported). What does this mean? Well it means I can write dart programs and they will be supported. However, this does not mean that my application has a backend on SAFE or that the application was even connected to SAFE in the first place, all it proves is that dart can be run in the SAFE browser without any support or converting to javascript. If my understanding is correct, this is very good news and adding dart to SAFE should not be as difficult as one would think.

Thanks! I am very glad you found it interesting (especially with the barebones explanation in the constitution! I try to make the constitution as code like and specific as possible). If you are interested in reading more on the subject, I am currently writing an explanation as to how the system works and why it is designed that way. I will send you the document, feel free to take a look at it! :smile:

I’ve never heard of that proposal, seems like a very interesting read, I look forward to it.


Your Dart code working is very encouraging. Do you have a link to the client - server documentation? The next step would be to create a compatibility layer so your app can interact with SAFE.

Thanks for the document, I look forward to reading it that too :slight_smile:


Would love to hear your feedback

1 Like

Thanks for the links. Those show the low level support for HTTP requests. I had a quick search but didn’t find the APIs that show what higher level server features you might use as a client. I was hoping to see what kind of high level RESTful APIs are exposed by the server, because one way to support Dart clients would be to replicate that on the client side, using a library that implemented it via the SAFE API. That’s the approach I used to get a Solid app to work on SAFE

Thanks @tomguim for your quick introduction on Dart. I think I’ve looked at it a few years back and concluded it just wasn’t yet ready because of its community. And the fact it was very fast-changing, making it hard to use for production software. Thanks to you I just looked into it again, and it only seems to have improved. Objectively I agree with you on that it’s a better NodeJS.

Looking at the Dart documentation for the global window object it seems like Dart can use window the same as you would from within JavaScript? That might make it easy to use the SAFE API from within the browser as the API is exposed through the window.safe object.

Outside of the browser, in NodeJS, I’m not sure what Dart is capable of. I can’t find a straight-forward way to call an NPM package/NodeJS code from Dart. That might mean bindings have to be made from the SAFE client Rust libraries, which might be more reliable from a Dart perspective anyway.

Would be cool if we have a example Dart application that interacts with the SAFE Network! Should be simpler using the browser than NodeJS.


Thats a really simple and elegant solution if it works! I will do some experimenting later this week.

As for npm packages, I do not much about how to do that.
If really needed I think that you could have a js file and import the package, then in a dart file use dart:js to interact with the javascript directly.


For NodeJS any of the following packages should solve those problems:

Ideally that would be the best most secure solution anyway, although more complicated.

1 Like

The dart:io library contains a lot of high level functions, I think this will help:


I see that flutter is in the general top trending list on Github this month.


Thanks, that’s interesting but what I’m looking is two things:

  • what services are supported by the server (eg management of storage, create folder, list files, write/read files)

  • what the http level API is for those services, assuming that’s available

The second is not essential. If you have it, then one option is to implement a SAFE replacement for it. If not, then you would re-implement the client service APIs but have them talk to SAFE.

If you can find how a client would create and list files and folders on a server I think that would help. Thanks for doing the leg work!

1 Like

@tomguim This is excellent potential. Thank you for the introduction. If Flutter could be a really nice replacement for Electron, I’d be over the :last_quarter_moon_with_face:.

If Dart has FFI support then there’d be no need for additional bindings than are already exposed in safe_client_libs, but it looks like FFI support is currently under development.