Dart port of https://github.com/mainroach/sandbox/tree/master/needle.js