Last active
July 10, 2018 04:21
-
-
Save baeharam/a49a0eb0dbf4280c8e7530a230925ba5 to your computer and use it in GitHub Desktop.
typedef, underscore parameter
This file contains 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
typedef Compare = int Function(Object a, Object b); | |
class SortedCollection { | |
Compare compare; | |
SortedCollection(this.compare); | |
} | |
// Initial, broken implementation. | |
int sort(Object a, Object b) => 0; | |
void main() { | |
SortedCollection coll = SortedCollection(sort); | |
assert(coll.compare is Function); | |
assert(coll.compare is Compare); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment