Skip to content

Instantly share code, notes, and snippets.

@xsokev
Last active June 12, 2018 16:44
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 xsokev/eefdb81d325b794ac3b67a2d621a0780 to your computer and use it in GitHub Desktop.
Save xsokev/eefdb81d325b794ac3b67a2d621a0780 to your computer and use it in GitHub Desktop.
Playing with JSON Arrays in Dart
import 'dart:convert';
void main() {
String aryString =
'{"data": "red, blue, green, red, yellow, deep orange, orange, blue, purple, green"}';
Map map = jsonDecode(aryString);
String listString = map['data'];
List cats = listString.split(', ');
cats.sort();
print(cats.toSet());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment