Reputation: 19308
How can we invoke methods like:
MyClass obj = new MyClass();
obj.fun1().fun2()....;
Just like alertDialog in Android.
new AlertDialog.Builder(this).setTitle().create().show();
Thanks in advance.
Upvotes: 1
Views: 49
Reputation: 23526
That's basically the builder pattern, where your methods return this
, but you can do that even prettier in Dart with Method cascades
:
MyClass obj = new MyClass()
..fun1()
..fun2()
..fun3();
Upvotes: 6