xxxxxxxxxx
Making a dynamic parameter optional
>> bind it to the class immediately after super.key e.g {super.key, this.optionalParameter}
>> declare it adding ? to it's type e.g final String? this.optionalParameter
xxxxxxxxxx
void greet(String name, {String prefix = 'Hello'}) {
print('$prefix, $name!');
}
void main() {
greet('Alice'); // Output: Hello, Alice!
greet('Bob', prefix: 'Hi'); // Output: Hi, Bob!
}