Spawning isolates in Dart

Spawning new isolates in Dart is easy if you know how to do it:


[dart]import ‚dart:isolate‘;
import ‚dart:async‘;

void main() {
Future isolate1 = Isolate.spawnUri(Uri.parse(‚isolate.dart‘), [], null);
Future isolate2 = Isolate.spawnUri(Uri.parse(‚isolate.dart‘), [], null);

Future.wait only waits until the two isolates are spawned. If the main application stops running, the two spawned isolates will stop running as well. That’s why we need a while(true)-loop here.

The isolate itself looks like this:

[dart]library isolate;

void main() {

The two arguments after the URI are used for a list of arguments and an optional message. If you want to use this, just modify the main method of your isolate:

void main(args) {…}
void main(args, message) {…}[/dart]

Nested Polymer Elements and Data Binding in Google’s Dart

Nesting Polymer Elements in Dart can be difficult sometimes. I want to give you some ideas how to nest polymer elements in Dart and how to realize data binding between multiple nested elements. Let’s get started:

Nested Polymer Elements and Data Binding in Google’s Dart weiterlesen

[Dart+Polymer] Styling Elements

Styling custom elements is sometimes tricky. In general the website styles do NOT apply to the custom element. There is a special attribute called „apply-author-styles“ that can be set to „true“ to apply your website’s styles to your custom element.

In general each custom element should have its  styles separated from the website so it can be reused easily. Let’s have a look at a simple example:

[Dart+Polymer] Styling Elements weiterlesen