Book Image

Mastering Dart

By : Sergey Akopkokhyants
Book Image

Mastering Dart

By: Sergey Akopkokhyants

Overview of this book

Table of Contents (19 chapters)
Mastering Dart
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 3. Object Creation

In this chapter, we will talk about the creation of objects. We will see how and when to create them using best practices from the programming world, and then find a place for them to be accommodated in Dart. The different techniques covered here will help us to make correct choices that will be useful in different business cases. In this chapter, we will cover the following topics:

  • A generative constructor

  • A constructor with optional parameters

  • A named constructor

  • A redirecting constructor

  • A private constructor

  • A factory constructor

  • A constant constructor

  • Initialization of variables

  • Syntactic sugar