Skip to content

Instantly share code, notes, and snippets.

View xxgreg's full-sized avatar

Greg Lowe xxgreg

  • Wellington, New Zealand
View GitHub Profile
import 'dart:convert';
import 'dart:collection';
import 'dart:typed_data';
main() {
var str = '12345☺';
var bytes = UTF8.encode(str);
print(decodeUtf8Slice(bytes, 5, 3));
print(decodeUtf8Slice(bytes, 5));
import 'package:observe/observe.dart';
class ObsTest extends Observable {
@observable int x;
void xChanged(c) {
print('xChanged: $c');
}
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
const SPLIT_SENTINEL = const [42];
class Splitter extends Converter<List<int>, List<List<int>>> {
Splitter(this._splitOnByte);
import 'dart:async';
import 'dart:chrome';
import 'dart:html';
import 'package:js/js.dart' as js;
void main() {
var open = new ButtonElement()..text = 'Open';
document.body.children.add(open);
write(s) => document.body.children.add(new DivElement()..text = s);
Create the files shown below, make sure dart-sdk/bin is in your path and run:
pub install
This will fetch the source for the postgresql library, and put it in a sub-directory called packages.
Then run the program:
dart main.dart