0

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!

Eden Nahum
  • 75
  • 1
  • 5

0 Answers0