September 2019
Beginner
512 pages
12h 52m
English
The most simplistic way to define a library is by adding all the interrelated code, that is, classes, top-level functions, and variables into one single file. For example, our previous Person library is as follows:
class Person { String firstName; String lastName; PersonType _type; Person({this.firstName, this.lastName}); String toString() => "($_type): $firstName $lastName";}enum PersonType { student, employee }class Student extends Person { Student({firstName, lastName}) : super(firstName: firstName, lastName: lastName) { _type = PersonType.student; }}class Programmer extends Person { Programmer({firstName, lastName}) : super(firstName: firstName, lastName: lastName) { _type = PersonType.employee; }}
There is nothing ...
Read now
Unlock full access