Book Image

Learning Dart, Second Edition - Second Edition

By : Ivo Balbaert
Book Image

Learning Dart, Second Edition - Second Edition

By: Ivo Balbaert

Overview of this book

Table of Contents (18 chapters)
Learning Dart Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Dartlero tasks – a many-to-many model in MySQL


A one table project is quite unrealistic; let's now revisit the dartlero_project_tasks application in Chapter 8, Developing Business Applications with Polymer Web Components. This has a many-to-many relationship between the project and employee concepts, task being the intermediate concept; data is stored only in the browser's local storage. In the dartlero_tasks project (code can be cloned from https://github.com/dzenanr/dartlero_tasks), we have the same model built on Dartlero, but the data can be stored on the server either in the JSON format or in a MySQL database. The startup script for both the options is bin/dartlero_tasks.dart. The model and the data access layer are defined in library dartlero_tasks lib/model/darlero_tasks.dart.

The JSON storage

If you want to use the JSON file storage, you have to create a command-line launch for the bin/dartlero_tasks.dart script. In the run/manage launches of Dart Editor, enter two script arguments...