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.
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?
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'); }
Wow, impeccable, subscribed... You know how to explain things.
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.
thanks for your videos
Sir why do you use exclamation mark in the getter method?
Because of ?, don't worry, you will learn the meaning of (!) mark on null safety section.
dart-tutorial.com/null-safety/
Why are not using Constractuructor while handling Encaps..... and if yes can we use it ??
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?
how can i contract you sir
thanks you
how can I contact you sir?
bishworajpoudelofficial@gmail.com
Thankyou sir
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);
}