How to use this keyword in DART
In this article, i am going to explain about this keyword.
This in DART
The this reserved word denotes the target of access current member invocation. you can use this in a factory constructor , static member or method. The this keyword references the current instance.
Syntax of this
Example of this in DART
class Use_this{
num a,b;
Add(num a, num b){
this.a = a;
this.b = b;
print("${a+b}");
}
}
main(){
Use_this obj = new Use_this();
obj.Add(1, 2);
}
|
Output:
Ask Your Question
Got a programming related question? You may want to post your question here