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
void start() { | |
window.animationFrame.then(pump); | |
} | |
void pump(num delta) { | |
_time.pump(); | |
_engine.update(_time); | |
_engine.draw(_time); | |
if (_keepPumping) |
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:io'; | |
void main() { | |
getFiles().then((List<String> paths) { | |
print(paths[0]); | |
}); | |
} | |
Future<List<String>> getFiles() { | |
Completer<List<String>> c = new Completer<List<String>>(); |
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
var d = new Directory("PATH"); | |
d.exists().then((bool exists) { | |
if (!exists) | |
return; | |
d.list().toList().then((List<FileSystemEntity> entities) { | |
entities.forEach((FileSystemEntity entity) { | |
if (entity is File) { | |
// Do something with the file | |
} |
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:json' as json; | |
class CartItem { | |
int id; | |
String name; | |
String category; | |
CartItem(this.id, this.name, this.category); | |
Map toJson() { |
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:html'; | |
void main() { | |
RtcPeerConnection pc1 = new RtcPeerConnection(null); | |
RtcPeerConnection pc2 = new RtcPeerConnection(null); | |
pc1.onAddStream.listen((MediaStreamEvent e) { | |
print("pc1 got stream"); | |
}); | |
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:html'; | |
void main() { | |
RtcPeerConnection pc1 = new RtcPeerConnection(null); | |
RtcPeerConnection pc2 = new RtcPeerConnection(null); | |
pc1.onAddStream.listen((MediaStreamEvent e) { | |
print("pc1 got stream"); | |
}); | |
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
test("Channel, joining/leaving, fires event", () { | |
User u = TestFactory.getTestUser(userId, ws); | |
MockChannelConnectionEventListener l = new MockChannelConnectionEventListener(); | |
c.subscribe(l); | |
bool wasJoined = false; | |
bool wasLeft = false; | |
l.joinCallback = (Channel chan, User user) { | |
expect(chan, equals(c)); | |
expect(user, equals(u)); |