You've worked with classes and methods, but it's possible to perform multiple sets of instructions inside your classes. In this video, explore dart constructors and learn how to implement them into your existing code.
we already started seeing Dart constructors. … And these are the bits of code that we write … inside our Dart classes in order … to be able to create a object from the class. … So if our classes are the blueprints for our object, … where we plan out what properties the eventual object … will have, what methods it will be able to perform, … then the constructor is the part of the code … and these are simply just the instance variables … that live inside the class. … And then we've got our methods, … which are essentially another word … for functions that are inside a class. … And when I say, inside a class, … it basically means that the eventual object … that gets created from this class, … so in this case it would be a Human object, … it would have these properties … and it would be able to perform these methods. … So these methods and properties are actually associated … with an object rather than just free floating around. … Now, the third thing that we've already seen … as well is the constructor. …
This course was created by London App Brewery. We are pleased to host this content in our library.