Last active
August 29, 2022 08:25
-
-
Save iapicca/ef1a43907d1f2a5cb6a64f44cdec7662 to your computer and use it in GitHub Desktop.
extension do not warn for error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:async'; | |
| typedef Nullary<T> = T Function(); | |
| typedef NullaryAsync<T> = Nullary<Future<T>>; | |
| typedef NullaryFutureOr<T> = Nullary<FutureOr<T>>; | |
| typedef Unary<T, S> = T Function(S); | |
| typedef UnaryAsync<T, S> = Unary<Future<T>, S>; | |
| typedef UnaryFutureOr<T, S> = Unary<FutureOr<T>, S>; | |
| extension NullaryFutureOrToNullaryAsync<T> on NullaryFutureOr<T> { | |
| NullaryAsync<T> get future => call(); | |
| } | |
| extension UnaryFutureOrToUnaryAsync<T, S> on UnaryFutureOr<T, S> { | |
| UnaryAsync<T, S> get future => call(); | |
| } | |
| FutureOr<void> nullary() {} | |
| FutureOr<void> unary(dynamic _) {} | |
| void main() { | |
| print(nullary.future.runtimeType); | |
| print(unary.future.runtimeType); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment