Skip to content

[Feature request] Add ability to match multiple classes in Generics #53360

Closed
@eximius313

Description

@eximius313

Java allows for & in Generics.
With it, one can do something like this:

abstract interface class MyInterface1 {
  String doSomething();
}
abstract interface class MyInterface2 {
  String doOther();
}

class MyService<T extends MyInterface1 & MyInterface2> {
  void operateOn(T t) {
      //can call "doSomething" from "MyInterface1" and "doOther" from "MyInterface2"
  }
}

Could you please allow such a syntax?


In your issue, please include:

  • Dart version and tooling diagnostic info (dart info) -> - Dart 3.0.0 (stable) (Thu May 4 01:11:00 2023 -0700) on "windows_x64"
  • Whether you are using Windows, macOS, or Linux (if applicable) -> Windows 10
  • Whether you are using Chrome, Safari, Firefox, Edge (if applicable) -> N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-duplicateClosed in favor of an existing report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions