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
Creating an object
A class is a blueprint for objects. The process of creating objects from a class is called instantiation. An object ...
Get Dart: Scalable Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.