Skip to content

Instantly share code, notes, and snippets.

@antaranyan
Created April 19, 2020 21:57
Show Gist options
  • Select an option

  • Save antaranyan/010b4e7775daa484f11d571c199978c2 to your computer and use it in GitHub Desktop.

Select an option

Save antaranyan/010b4e7775daa484f11d571c199978c2 to your computer and use it in GitHub Desktop.
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);
}
@antaranyan
Copy link
Author

But:

typedef Distance = float; // :'(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment