-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).Dart language related items (some items might be better tracked at github.com/dart-lang/language).closed-duplicateClosed in favor of an existing reportClosed in favor of an existing reporttype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
The void type is only allowed as a function return type. It is equivalent to "Null" except for documentation purposes (and allowing "return;" statements in the body).
The documentation meaning is that the function does not return a meaningful value, and its result shouldn't be used.
For Future, we have the same documentation need. Some Futures carry no meaningful value, they are effectively the delayed results of evaluating a void function.
It would improve documentation if these futures could be typed as "Future<void>". By duality, it would be equivalent to "Future<Null>", but documenting a different intent.
It's likely to also be useful in other places. Perhaps we should allow "void" everywhere we currently allow "dynamic".
Metadata
Metadata
Assignees
Labels
area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).Dart language related items (some items might be better tracked at github.com/dart-lang/language).closed-duplicateClosed in favor of an existing reportClosed in favor of an existing reporttype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug