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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.