Say, I have this:
VoidCallback callback;
It can only be called if it isn't null, so for that I am doing:
if (callback != null) callback();
Is there any shorthand similar to this?
callback?.();
Say, I have this:
VoidCallback callback;
It can only be called if it isn't null, so for that I am doing:
if (callback != null) callback();
Is there any shorthand similar to this?
callback?.();
Thanks to @jamesdlin, the solution is:
VoidCallback callback;
callback?.call();