[dart-announce] Breaking Change - More types for Future.timeout

91 views
Skip to first unread message

'Florian Loitsch' via Dart Announcements

unread,
Feb 9, 2016, 1:05:15 PM2/9/16
to announce
I just landed a patch [0] that adds more types to the Future.timeout function. It's unlikely, but there is a chance that a program could now fail in checked mode.

We changed the signature from the timeout function from:
Future timeout(Duration timeLimit, {onTimeout()});
to
Future<T> timeout(Duration timeLimit, {onTimeout()});

This implies that the `onTimeout` function must return a T (or a Future<T>) now.

If you rely on the old behavior, you can work around the new types by introducing a `.then`:

typedFuture.timeout(...)
becomes
typedFuture.then((x) => x).timeout(...)

// florian

--
For more news and information, visit https://plus.google.com/+dartlang
 
To join the conversation, visit https://groups.google.com/a/dartlang.org/

Jan Mostert

unread,
Feb 10, 2016, 3:08:53 AM2/10/16
to mi...@dartlang.org, announce
In which version will this be released?


--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
Reply all
Reply to author
Forward
0 new messages