Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to extend `dart:async`s Future class

Is it possible to create a custom implementation of the abstract class Future?

like image 792
Günter Zöchbauer Avatar asked Sep 05 '25 06:09

Günter Zöchbauer


1 Answers

Extending or implementing Future is prevented to allow several performance optimizations which wouldn't be possible otherwise.

The package async provides a DelegatingFuture that can be extended instead and which delegates to another future.

For more details see the discussion at https://github.com/dart-lang/sdk/issues/24335

like image 100
Günter Zöchbauer Avatar answered Sep 07 '25 19:09

Günter Zöchbauer