Is there a way to test the existence of a function or method in Dart without trying to call it and catch a NoSuchMethodError error?
I am looking for something like
if (exists("func_name")){...}
to test whether a function namedfunc_nameexists.
Thanks in advance!
You can do that with mirrors API :
existsFunctiononly tests if a function withfunctionNameexists in the current library. Thus with functions available byimportstatementexistsFunctionwill returnfalse.