Skip to content

Instantly share code, notes, and snippets.

View kwalrath's full-sized avatar

Kathy Walrath kwalrath

View GitHub Profile
@kwalrath
kwalrath / main.dart
Last active September 20, 2018 16:52 — forked from chalin/main.dart
futures/async-await
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
Future<void> printDailyNewsDigest() async {
var newsDigest = await gatherNewsReports();
print(newsDigest);
}
@kwalrath
kwalrath / main.dart
Last active September 20, 2018 16:53 — forked from chalin/main.dart
futures/futures-api
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
Future<void> printDailyNewsDigest() {
final future = gatherNewsReports();
return future.then(print);
// You don't *have* to return the future here.
@kwalrath
kwalrath / main.dart
Created August 16, 2018 21:25 — forked from Sfshaza/main.dart
Java-to-Dart codelab: Using a try-catch statement
import 'dart:math';
abstract class Shape {
factory Shape(String type) {
if (type == 'circle') return Circle(2);
if (type == 'square') return Square(2);
// To trigger exception, don't implement a check for 'triangle'.
throw 'Can\'t create $type.';
}
num get area;
@kwalrath
kwalrath / hint.txt
Last active May 17, 2019 19:58 — forked from RedBrogdon/hint.txt
DartPad Cheatsheet Codelab - 2 - Null-aware operators
All you need to do in this exercise is replace the TODO comments with either ?? or ??=.
Read the codelab text to make sure you understand both, and then give it a try.
@kwalrath
kwalrath / hint.txt
Last active May 17, 2019 22:03 — forked from RedBrogdon/hint.txt
DartPad Cheatsheet Codelab - 5 - Collection literals
This exercise is fairly straightforward. Just add a list, set, or map literal after each equals sign.
See the codelab text for the correct syntax to use.
@kwalrath
kwalrath / hint.txt
Last active May 18, 2019 03:38 — forked from RedBrogdon/hint.txt
DartPad Cheatsheet Codelab - 12 - Initializer lists
Two assignments that need to happen: letterOne should be word[0], and letterTwo should be word[1].
@kwalrath
kwalrath / index.html
Created September 30, 2019 18:08 — forked from Arun8295/index.html
portmanteaux_simple
<!DOCTYPE html>
<!--
Copyright (c) 2012, the Dart project authors.
Please see the AUTHORS file for details.
All rights reserved. Use of this source code
is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<html>
@kwalrath
kwalrath / index.html
Created September 30, 2019 18:08 — forked from Arun8295/index.html
portmanteaux
<!DOCTYPE html>
<!--
Copyright (c) 2012, the Dart project authors.
Please see the AUTHORS file for details.
All rights reserved. Use of this source code
is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<html>
@kwalrath
kwalrath / index.html
Created October 2, 2019 20:43 — forked from smolck/index.html
todo
<!DOCTYPE html>
<!--
Copyright (c) 2012, the Dart project authors.
Please see the AUTHORS file for details.
All rights reserved. Use of this source code
is governed by a BSD-style license that can be
found in the LICENSE file.
-->
@kwalrath
kwalrath / index.html
Created October 3, 2019 21:51 — forked from dhanushuUzumaki/index.html
portmanteaux
<!DOCTYPE html>
<!--
Copyright (c) 2012, the Dart project authors.
Please see the AUTHORS file for details.
All rights reserved. Use of this source code
is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<html>