Dart is a modern and powerful programming language. Google intentionally designed it to be unsurprising. In many ways, it’s a boring language, and that’s a good thing! It means Dart is fast and easy to learn. While Dart does have some unique characteristics, if you have any experience with other object-oriented or C-style languages, you’ll immediately feel at home with Dart. Even if you come here as a complete beginner to programming, Dart is a good place to start. The concepts that you’ll learn in this book will give you a solid foundation for your coding career.
There’s a good chance you picked up this book because you want to make a Flutter app, and you heard you needed to learn Dart. It was no accident that Flutter chose Dart as its language. The Dart virtual machine allows lightning-fast development-time rebuilds, and its ahead-of-time compiler creates native applications for every major platform. As one of the most versatile languages on the market today, you can use Dart to write anything from command-line apps and backend servers to native applications for Android, iOS, web, Mac, Windows, Linux and even embedded devices.
It’s no wonder then that developers across the world have taken notice. Rather than completely rewriting the same application in different languages for multiple platforms, developers save countless hours by using a single language and a shared codebase. This translates to a win for companies as well because they save money without sacrificing speed.
About This Book Series
In its original form, this book started as a single, 10-chapter volume called Dart Apprentice. While writing the second edition, we broke the overly-long chapters into more manageable sub-topics, rearranged the teaching order, expanded the explanations and examples, and added completely new chapters. The original 10 chapters grew to almost 30. We didn’t want to overwhelm readers with a massive tome but to provide them with a learning path that they could complete in measurable steps. For this reason, we split Dart Apprentice into two volumes:
- Dart Apprentice: Fundamentals, the book you have here, is the first of the two-part series. It covers basic programming concepts like expressions, data types, control flow, loops, functions, classes and collections. When you complete this book, you’ll have reached the upper-beginner level.
- The second book, Dart Apprentice: Beyond the Basics, will build on the concepts you learn here and introduce new topics like string manipulation, anonymous functions, inheritance, interfaces, generics, error handling and asynchronous programming. If you complete that book, you can consider yourself a solid intermediate-level programmer in Dart.
Book Sample Projects
The book comes with supplemental material that’s available as an online GitHub repository. In each chapter folder, you’ll find a folder called starter that contains a starter project with an empty
main function. You can either open this empty project in your editor by going to File ▸ Open in the menu, or just create a new project in the way you’ll learn in Chapter 1.
In addition to the starter project, chapters will also have final and challenge folders. You can refer to the final folder if you get lost during the lesson. It’ll contain the code from that lesson. Likewise, the challenge folder will contain the answers to the exercises and challenges from that chapter. You’ll learn the most if you don’t copy and paste this code but type it yourself.
You’ll sometimes find exercises in the middle of a chapter after learning about some topic. These are optional but generally easy to complete. Like the challenges, they’ll help you solidify what you’re learning.
Challenges are an important part of Dart Apprentice: Fundamentals. At the end of each chapter, the book will give you one or more tasks to accomplish that make use of the knowledge you learned in the chapter. Completing them will not only help you reinforce that knowledge but will also show that you’ve mastered it.
How to Read This Book
Each chapter of this book builds on the ones that precede it, so you’ll find it easiest to understand if you progress through the chapters in order.
Dart Apprentice: Fundamentals was written with the beginner in mind. If that’s you, you’ll learn the most by following along and trying each of the code examples, exercises and challenges as you come to them. The way to learn to code is by writing code and experimenting with it. That can’t be emphasized enough.
More advanced readers may want to skim the content of this book to get up and running quickly. If that’s you, try the challenges at the end of every chapter. If they’re easy, move on to the next chapter. If they’re not, go back and read the relevant parts of the chapter and check the challenge solutions.
Finally, for all readers, kodeco.com is committed to providing quality, up-to-date learning materials. We’d love to have your feedback. What parts of the book gave you one of those aha learning moments? Was some topic confusing? Did you spot a typo or an error? Let us know at forums.kodeco.com and look for the particular forum category for this book. We’ll make an effort to take your comments into account in the next update of the book.