A working program always gives its developer a sense of joy, and rightfully so. However, this doesn't that mean you can leave the code as it is. On the contrary, carefully review your code for some time to see whether there is room for improvement or optimization. For example, are the names you used clear enough? The color of a hidden cell is now named simply COLOR_CODE
in board.dart
, renaming it to HIDDEN_CELL_COLOR_CODE
makes its meaning explicit. The List
object used in the Cells
class can indicate that it is List<Cell>
, by applying the fact that Dart lists are generic. The parameter of the every
method in the Cell
class is more precise—it is a function that accepts a cell and returns bool
. Our onMouseDown
event handler contains our game logic, so it is very important to tune it if possible. After some thought, we see that the code from the previous spiral can be improved; in the following line, the second condition after &&
is, in fact...
Learning Dart, Second Edition - Second Edition
By :
Learning Dart, Second Edition - Second Edition
By:
Overview of this book
Table of Contents (18 chapters)
Learning Dart Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
Dart – A Modern Web Programming Language
Getting to Work with Dart
Structuring Code with Classes and Libraries
Modeling Web Applications with Model Concepts and Dartlero
Handling DOM in a New Way
Combining HTML5 Forms with Dart
Building Games with HTML5 and Dart
Developing Business Applications with Polymer Web Components
Modeling More Complex Applications with dartling
Local Data and Client-Server Communication
Data-Driven Web Applications with MySQL and MongoDB
Index
Customer Reviews