hello bisworaj , first of all thank you for the easy to understand tutorial , i just want to inform you that i tried to run an encapsulated code in another dart file and it worked with importing the original dart file and even without importing the original dart file where i created the encapsulation , is there an update we are missing?
Do you know how to do data hiding with named parameters in the constructor. It seems that you just cannot do it, but to me that is just not good enough. Is there any work around? Thanks a lot.
class Patient{ String name; int age; String disease; Patient({this.name = 'Ram',this.age = 20,this.disease = 'Sorises'}); } void main(){ Patient patient = Patient(); final pate = patient.name; final age = patient.age; final disease = patient.disease; print(' Name of patient is $pate'); print('Age of patient is $age'); print('disease of patient is $disease'); }
class Person { String? name; String? planet; Person({this.planet = 'Earth'}); } void main(){ Person person = Person(); final name = 'Lavlesh'; print('My name is $name'); print(person.planet); }