Putting Models, Collections, and Views Together to Create New Records

A true single-page application needs to do more than display a static list of the records in the back end. It should be able to perform all of the usual CRUD operations at a minimum. Let’s walk through creating records in the UI to get a feel for how this might work in a Dart MVC-like approach.

Rather than attempt to make our existing ComicsView try to do too much, let’s create a new view class for the logic responsible for creating comic book records. In the main entry point, the new view class can be created after everything else is built.

 
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.