This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
class SqlResultSet { | |
List rows; | |
SqlResultSet(this.rows); | |
} | |
Future _runInTxn(txn(Transaction x)) { | |
print('_runInTxn'); | |
return new Future.value(txn(new Transaction())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
Stream<int> a() async* { | |
for (int i = 1; i <= 10; ++i) { | |
print('yield $i'); | |
yield i; | |
} | |
} | |
main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 29565067 | |
Map f = { | |
0 : 0, | |
1 : 1, | |
2 : 0, | |
3 : 1, | |
4 : 0, | |
5 : 1 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 29567236 | |
class Status { | |
static const off = const Status._(0); | |
static const on = const Status._(1); | |
final int value; | |
const Status._(this.value); | |
} | |
doSomething1([Status status = Status.off]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async' show Future, Stream; | |
class SomeClass { | |
int _someValue; | |
void set someValue(int val) => | |
new Future.delayed(new Duration(milliseconds: 500), () => _someValue = val); | |
Future set someValue(int val) => | |
new Future.delayed(new Duration(milliseconds: 500), () => _someValue = val); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SO 29629868 | |
main() { | |
var languages = <String>["dart", "javascript", "coffeescript", "typescript"]; | |
var tmpList = languages.map((e) => e.toUpperCase()).toList(); | |
print(tmpList); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SO 29567322 | |
class Action { | |
final Function function; | |
final String description; | |
Action(this.function, this.description); | |
call() => function(); | |
int get hashCode => description.hashCode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SO 29681639 | |
import 'dart:convert'; | |
import 'dart:async' show Future, Stream; | |
import 'dart:math' show Random; | |
final rnd = new Random(); | |
main() { | |
lineStream() | |
.transform(new Utf8Decoder()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// not tested with binding expressions (port of http://stackoverflow.com/a/31320384/217408) | |
// probably needs bound values set to `template` | |
injectBoundHtml(highlightedValue, $['container']); | |
// TODO(zoechi) create feature request to get this into the `Polymer` class | |
get _polymerBase { | |
final JsObject _polymer = context['Polymer']; | |
return (o) { | |
return o is JsObject ? o : new JsObject.fromBrowserObject(o); | |
}(_polymer['Base']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ss -ltp |