You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is no type declaration for individual record types. Records are structurally typed based on the types of their fields. A record's shape (the set of its fields, the fields' types, and their names, if any) uniquely determines the type of a record.
But it is possible to typedef a record type, and then use that type as parameter type or return type from a function for example.
This page never describes or shows with an example that a record type can be given a name for ease of use (even if a unique name will not cause records of the same shape to be distinct).
Expected fix
This could be explained better and / or shown with example with the objective to encourage easier-to-use records.
Additional context
No response
I would like to fix this problem.
I will try and fix this problem on dart.dev.
The text was updated successfully, but these errors were encountered:
Page URL
https://dart.dev/language/records/
Page source
https://github.com/dart-lang/site-www/tree/main/src/content/language/records.md
Describe the problem
This paragraph appears somewhat misleading:
There is no type declaration for individual record types. Records are structurally typed based on the types of their fields. A record's shape (the set of its fields, the fields' types, and their names, if any) uniquely determines the type of a record.
But it is possible to typedef a record type, and then use that type as parameter type or return type from a function for example.
This page never describes or shows with an example that a record type can be given a name for ease of use (even if a unique name will not cause records of the same shape to be distinct).
Expected fix
This could be explained better and / or shown with example with the objective to encourage easier-to-use records.
Additional context
No response
I would like to fix this problem.
The text was updated successfully, but these errors were encountered: