Search code examples
dartdart-async

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


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


Solution

  • 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