AppBrewery - Quizzler Flashcards
setState call syntax
void setState( void Function fn) setState( () { // ... } );
Dart class syntax
class Name { // properties Name(){ // constructor }
}
pillars of OOP
. Abstraction
. Polymorphism
. Inheritance
. Encapsulation
where to add classes
in lib folder
abstraction
abstract away details of implementation; get to idea
Abstraction is the technique of hiding implementation. At it’s core there’s not much more to that answer. The bulk of meaning to abstraction come from how and why it is used.
It is used for the following scenarios
Reduce complexity. (Create a simple interface)
Allow for implementation to be modified without impacting its users.
Create a common interface to support polymorphism (treating all implementations of the abstracted layer the same.
Force users to extend the implementation rather than modify.
Support cross platform by changing the implementation per platform.
encapsulation
separate jobs+roles of different objects/classes
It’s simply a containment of information.
Encapsulation means that a class publishes only what is needed for others to use it, and no more.
enum syntax
enum Color { red, green, blue }
how to make a property private
prefix _
_prop
inheritance syntax dart
Subclass extends ParentClass
inheritance concept
inherit common properties and functions from parent class
polymorphism concept
changing shapes;
Poly = many
Morph = change or form
So polymorphism is the ability (in programming) to present the same interface for differing underlying forms (data types).
override common interface for custom subclass; e.g.
Shape super, .draw()
circle override .draw()
triangle override .draw()
many forms, one interface (draw)
how to override in dart
@override
overriddenFunction () { //… }
double
double data type in dart
class constructor syntax for same parameter and class prop name
class MyClass { int prop; MyClass (this.prop)