Hipster Collections

Recall from Chapter 1, Project: Your First Dart Application that our comics.dart looks something like this:

your_first_dart_app/web/scripts/skel.dart
 
import​ ​'dart:html'​;
 
import​ ​'dart:convert'​;
 
main() {
 
// Do stuff here
 
}

We replaced the // Do stuff here comment with code that retrieves the comic book collection from /comics and displays it on the web page. In MVC, the collection object retrieves the records, and a view object displays the contents of the collection.

mvc/web/scripts/comics.dart
 
import​ ​'dart:html'​;
 
import​ ​'dart:convert'​;
 
import​ ​'dart:collection'​;
 
main() {
 
var​ comics_view, comics_collection;
 
 
 
comics_collection = ​new​ ComicsCollection(
 
onChange: ()=> comics_view.render() ...

Get Dart 1 for Everyone now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.