• Objects

    An object in programming is like a container that holds things. It can be used to store information like a box can store toys. For example, we could create an object called "cat" and it could have different pieces of information inside it like the cat's name, its color, or even how many lives it has left. Objects help us keep track of all the pieces of information we need for a program.

      • Map, Dictionary, Variable Objects

      • void main() {
          var person = {
        	  'name': 'John',
        	  'age': 36
          };
        
          print(person['name']); // John
          print(person['age']); // 36
        }
      • Class Objects

      • class Person {
          String name;
          int age;
        
          Person(this.name, this.age);
        
          void greet() {
        	print('Hello my name is ' + this.name);
          }
        }
        
        void main() {
          var human = new Person('John', 36);
        
          print(human.name); // John
          print(human.age); // 36
          human.greet(); // Hello my name is John
        }