Skip to content

Proposal: Provide an "Async Aware" operator: #25986

Closed
@typotter

Description

@typotter

While it is helpful to unravel futures using async/await, when the non-future item you need is several futures deep, the awaits quickly become hard to read. This comes up a lot in testing/pageloader objects

Example:

expect( await( await (await childElement).description1)).innerText. "blah");

How about introducing an async operator to make this a little cleaner? Something like this:

expect( await childElement->description1->innerText, "blah");

The first await is for the Future returned by inner text. the "->" operator sees that the left side is a future, awaits it, then acts as the access operator. Doesn't have to be "->", but I like the parallel of de-futurizing to pointer dereferencing in c++.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions