Skip to content

Add standard interfaces like Disposable as Mixins in the Dart SDK #59678

Open
@escamoteur

Description

@escamoteur

One of the the great features of OO languages is polymorphism based on known interfaces.
Unfortunately, Dart has neglected to define interfaces that are standard in other SDKs. This makes it impossible to write generic libraries without casting objects to dynamic and try to call a method hoping it will be available, therefore hurting type safety.

The two most missed ones are probably

  • Disposable
  • Serializable

But I'm sure there might be some more. Thanks to mixins it should be possible to introduce such interfaces even today into existing classes of the Dart SDK, Flutter and all packages where it makes sense and improve the situation.

cc @FMorschel

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.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