Trigger functions of the Dart language

I am creating a scientific Calc application in DART. I do not know how to use trigonometric functions, such as sine, cosine. I used "math.sin ()", but it throws an exception "NO top-level getter math.get declared", how to solve it? thanks in advance

+3
source share
1 answer

To use trigonometric functions in Dart, import the library dart:math. For instance:

import 'dart:math';

main() {
  print(sin(PI));
}

If you want, you can import with a prefix to avoid namespace conflicts:

import 'dart:math' as Math;

main() {
  print(Math.sin(Math.PI));
}
+5
source

All Articles