By Developers, For Developers

Historical errata for Dart 1 for Everyone

PDF PgPaper PgTypeDescriptionFixed onComments
6ERROR

document.query() has been deprecated a long time ago…

2014-08-29As noted in that chapter, document.query() is deprecated so that it can be replaced by... document.query(). Since both the deprecated and replacement methods have the same API, I have opted to continue to use the short version.
6ERROR

navigator.webkitStartDart() is no longer a thing. Yay!

8ERROR

req.open(‘get’, ‘/comics’);

should be

req.open(‘get’, ‘/comics.json’);

7SUGGEST

Maybe if the reader is following along and paste code and trying it might help to add the statement

import ‘dart:convert’;

above the
void main()

7ERROR

var list_el = document.query(‘#comics-list’);

should be

var list_el = document.querySelector(‘#comics-list’);

3SUGGEST

The link to dart-comics. would help better if it was a link to a example focused on Part 1 and what describes rather than finished example

29SUGGEST

Its say “there is no reflection” is that really true?

31ERROR

document.query(‘h1’);
// => First

in the document
document.query(‘#people-list’);
// => Element with id of ‘people-list’
document.query(‘.active’);

should be

document.querySelector(‘h1’);
// => First

in the document
document.querySelector(‘#people-list’);
// => Element with id of ‘people-list’
document.querySelector(‘.active’);

32ERROR

All references to Query() should be QuerySelector()
and
QueryAll() should be QuerySelectorAll()

33SUGGEST

I’m using the Dart Editor and following works better

Element gallery = new Element.html(’

49SUGGEST

Chapter 6 is very intensive and a lot to follow. It would be helpful if not imperative to provide complete solution for the chapter in a link of at the end of the chapter. Also a diagram might help too. I have tried to follow but failed to get a working or at least runnable code inside the Dart Editor so far

The code is available for download. For individual files, click the links above the code samples in the PDF. The entire source code for the book available from “Source Code” link from the Book page (https://pragprog.com/book/csdart1/dart-1-for-everyone). \n \nI will re-read with an eye towards someone following along. I skipped some parts intentionally to keep the narrative moving, but I agree that could come at the expense of completeness. Hopefully I can work out a better balance. \n \nIf there are particular places that this breaks down, let me know -- that would be helpful. Regardless, I think I see a few spots that could already be improved. Thanks!
3ERROR

Using the downloaded code from this site, I had to make a couple of changes to the app.dart server in your_first_dart_app to get it to run:

1- Add

import ‘dart:convert’;

up top, and remove

import ‘package:json/json.dart’ as JSON;

2- In Public.handler(req), add this as the first line:

req.response.headers.contentType = new ContentType(“text”, “html”, charset: “utf-8”);

Otherwise the .html pages come back as text/plain and the browser shows the raw html instead of rendering it.

Dart 1.7.2 on a Mac running Yosemite.

Categories: