Printing a function as String in Dart

603 Views Asked by At

Dart question about printing function as a string -

I have this code on Dart-

sum(a, b) {
return a + b;
}

If i run -

print(sum.toString());

I get -

Closure: () => dynamic from Function 'sum':.

If i run it on JavaScript -

console.log(sum.toString());

the print is -

// "sum(a, b) {
// return a + b;
// }"

How do i do the same print like I show in JavaScript but in Dart?

Thanks friends!

0

There are 0 best solutions below