Last active
May 14, 2024 12:16
-
-
Save atreeon/48941d624906054513318852e4d0cf1a to your computer and use it in GitHub Desktop.
Typedef types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
An easy way to create a new type in Dart is using typedef. | |
The type is of course a named record so the underlining type would match any record where the property types are named the same. | |
*/ | |
typedef BarAndSpaceWidth = ({int barWidth, int spaceWidth}); | |
BarAndSpaceWidth getBarAndSpaceWidth() { | |
var blah = (barWidth: 10, spaceWidth: 20); | |
return blah; | |
} | |
main() { | |
var result = getBarAndSpaceWidth(); | |
print(result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment