Reallife experience with Dart

Reallife experience with Dart

I could show my Slack Chatbot written in Dart. It covers websockets, an API w/ redstone and a little bit AngularDart for the frontend.

Db6218c1b56d64e775eb79ea4f2889dd?s=128

Sebastian

July 27, 2016
Tweet

Transcript

  1. Reallife experience with Dart ViennaJS @Sgoettschkes https://stocksnap.io/photo/LTB7BB80VH

  2. None
  3. None
  4. blitzlicht Improve communication by asking simple questions. 1. Ask one

    question 2. Have people answer in their own words 3. Get insights
  5. blitzlicht in Action

  6. blitzlicht in Action

  7. blitzlicht in Action

  8. Code example

  9. Code example Websockets

  10. Code example void connect(String url) { WebSocket.connect(url).then((WebSocket websocket) { websocket.pingInterval

    = new Duration(seconds: 5); websocket.listen(process, onDone: reconnect, onError: reconnect); }); }
  11. Code example void connect(String url) { WebSocket.connect(url).then((WebSocket websocket) { websocket.pingInterval

    = new Duration(seconds: 5); websocket.listen(process, onDone: reconnect, onError: reconnect); }); }
  12. Code example void process(String message) { Map data = JSON.decode(message);

    // ... do something }
  13. Code example API

  14. Code example import 'package:redstone/redstone.dart' as app; void main() { app.start();

    }
  15. Code example @app.Group('/api/blitzlichts') class BlitzlichtService { @app.Route('/:id') read(String id, @Repo()

    Repository repo) async { Blitzlicht blitzlicht = await repo.findOne(where.id(new ObjectId.fromHexString(id))); return blitzlicht.toMap(); } }
  16. Code example @app.Group('/api/blitzlichts') class BlitzlichtService { @app.Route('/:id') read(String id, @Repo()

    Repository repo) async { Blitzlicht blitzlicht = await repo.findOne(where.id(new ObjectId.fromHexString(id))); return blitzlicht.toMap(); } }
  17. Code example @app.Group('/api/blitzlichts') class BlitzlichtService { @app.Route('/:id') read(String id, @Repo()

    Repository repo) async { Blitzlicht blitzlicht = await repo.findOne(where.id(new ObjectId.fromHexString(id))); return blitzlicht.toMap(); } }
  18. Code example @app.Group('/api/blitzlichts') class BlitzlichtService { @app.Route('/:id') read(String id, @Repo()

    Repository repo) async { Blitzlicht blitzlicht = await repo.findOne(where.id(new ObjectId.fromHexString(id))); return blitzlicht.toMap(); } }
  19. Code example AngularDart

  20. Code example import 'package:angular2/platform/browser.dart'; import 'package:blitzlicht/client/app_component.dart'; void main() { bootstrap(AppComponent);

    }
  21. Code example <head> <!-- snip --> <script async src="main.dart" type="application/dart"

    type=" application/dart"></script> <script async src="packages/browser/dart.js" type="text/javascript" ></script> <!-- snip --> </head>
  22. Code example <body> <blitzlicht> <p>Loading ...</p> </blitzlicht> </body>

  23. Code example @Component( directives: const [ROUTER_DIRECTIVES], providers: const [ROUTER_PROVIDERS], selector:

    'blitzlicht', templateUrl: 'app_component.html') @RouteConfig(const [ const Route( path: '/', name: 'Index', component: IndexComponent, useAsDefault: true), ]) class AppComponent implements OnInit { Future<Null> ngOnInit() async { print('THIS IS BLITZLICHT'); } }
  24. Code example import 'package:angular2/core.dart'; import 'package:angular2/router.dart'; @Component( directives: const [ROUTER_DIRECTIVES],

    selector: 'index', templateUrl: 'index_component.html') class IndexComponent {}
  25. None
  26. Summary https://pixabay.com/en/milky-way-andromeda-stars-galaxy-923801/

  27. https://www.dropbox.com/s/6z5aiwa8l09g2pa/86H.jpg