Dart constructor optional parameter
The parameter address is optional by making it nullable and put it in square brackets in the constructor.
class User { String name; int age; String? address; // <-- Nullable User(this.name, this.age, [this.address]); }
Search within Codexpedia
Custom Search
Search the entire web
Custom Search
Related Posts