Skip to content

Instantly share code, notes, and snippets.

@baeharam
Created July 10, 2018 04:26
Show Gist options
  • Save baeharam/40863067bccd390b42232d37982ffb48 to your computer and use it in GitHub Desktop.
Save baeharam/40863067bccd390b42232d37982ffb48 to your computer and use it in GitHub Desktop.
typedef
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