Skip to content

Instantly share code, notes, and snippets.

@frank06
Created January 5, 2020 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frank06/a1e59f3c2a2c885777c8968ddbf2a9da to your computer and use it in GitHub Desktop.
Save frank06/a1e59f3c2a2c885777c8968ddbf2a9da to your computer and use it in GitHub Desktop.
typedef Comparison<T> = int Function(T, T);
main() {
Comparison<String> crazy = (String a, String b) {
return ([-1, 0, 1]..shuffle()).first;
};
final animals = ['fox', 'cow', 'horse'];
animals.sort(crazy);
print(animals);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment