Skip to content

Instantly share code, notes, and snippets.

@Sfshaza
Sfshaza / main.dart
Last active August 29, 2015 14:27
futures/async-await-catch-error
// 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:html';
import 'dart:async';
Future printDailyNewsDigest() async {
String path =
'https://www.dartlang.org/samples-files/dailyNewsDigest.txt';
@Sfshaza
Sfshaza / main.dart
Last active August 29, 2015 14:27
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:html';
import 'dart:async';
Future printDailyNewsDigest() async {
String path =
'https://www.dartlang.org/samples-files/dailyNewsDigest.txt';
@Sfshaza
Sfshaza / index.html
Last active October 2, 2019 01:41
todo_with_delete
<!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.
-->
@Sfshaza
Sfshaza / index.html
Last active September 9, 2015 17:06
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.
-->
@Sfshaza
Sfshaza / main.dart
Last active April 23, 2018 15:14
streams/throw_error
// Copyright (c) 2015, 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<int> sumStream(Stream<int> stream) async {
var sum = 0;
try {
@Sfshaza
Sfshaza / main.dart
Last active September 9, 2015 17:06
streams/simple_stream
// Copyright (c) 2015, 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<int> sumStream(Stream<int> stream) async {
var sum = 0;
await for (var value in stream) {
@Sfshaza
Sfshaza / main.dart
Last active September 9, 2015 17:06
streams/last_positive
// Copyright (c) 2015, 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<int> lastPositive(Stream<int> stream) async {
var lastValue = null;
await for (var value in stream) {
@Sfshaza
Sfshaza / index.html
Last active June 27, 2018 15:08
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.
-->
@Sfshaza
Sfshaza / index.html
Last active June 27, 2018 16:22
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.
-->
@Sfshaza
Sfshaza / index.html
Last active September 9, 2015 17:06
mini_with_style
<!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.
-->