dart-lang / dart-lang/language

Typed Maps - like interfaces in TypeScript

Open
#783 50 comments 100 reactions 0 assignees View on GitHub
feature
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

I would love to see typed Maps in Dart like it is possible in TypeScript.

TypeScript example:

```TypeScript
interface IPerson {
name: string;
age: number;
height?: number;
}

const person: IPerson = {
name: "Max",
age: 26
}
```

I wish Dart would support something like that so i do not have to create a class for it. It could look something like this:

```Dart
interface IPerson {
String name;
int age;
height? double;
}

Map person = {
name: "Max",
age: 26,
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.