Skip to content

Instantly share code, notes, and snippets.

@jebright
Created September 23, 2018 16:22
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 jebright/90080c459eafd99a0bf6a0294edc19ab to your computer and use it in GitHub Desktop.
Save jebright/90080c459eafd99a0bf6a0294edc19ab to your computer and use it in GitHub Desktop.
Dart Fundamentals - Lists - Sort
void main() {
List<double> prices = [0.25, 1.00, 3.33, 0.75, 4.25, 5.99];
prices.sort();
log(prices); //prints 0.25, 0.75, 1, 3.33, 4.25, 5.99
List<String> alphabet = ["b", "c", "a"];
alphabet.sort();
log(alphabet); //prints a,b,c
}
void log(var lst) {
lst.forEach((n) => print(n));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment