Michael Ben-Nes
Michael Ben-Nes

Reputation: 7645

Type composition in dart

In some class I need to repeat over the over some complex types. Like:

List<Something<String>>

Is it possible to compose this type in Dart so I wont have to keep re declaring it over and over?

Like in Go:

var whatever []String

I tried to create class that extend this type:

class WhateverList extends List<Something<String>> {}

But it complained about Missing concrete implementation. I though about using the decorator pattern but that will require to map all the methods. Seems a bit over kill.

Is there a way to compose new types in an elegant short syntax?

Upvotes: 2

Views: 369

Answers (1)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 657168

Currently not, but there are plans to add type aliases to Dart.

Upvotes: 1

Related Questions