O'Reilly logo

Dart 1 for Everyone by Chris Strom

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required