Skip to content

Instantly share code, notes, and snippets.

@bsutton
Last active October 31, 2019 21:58
Show Gist options
  • Save bsutton/a5175401516dbb9242a0edec4c89fef6 to your computer and use it in GitHub Desktop.
Save bsutton/a5175401516dbb9242a0edec4c89fef6 to your computer and use it in GitHub Desktop.
Future sort
void main() {
List<Future<Option>> options = [Future.value(Option(2)), Future.value(Option(3)), Future.value(Option(1))];
options.sort((lhs, rhs) => lhs.ordinal - rhs.ordinal);
}
class Option
{
int _ordinal;
Option(this._ordinal);
int get ordinal
{
return _ordinal;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment