2
votes

Is there a way to access Math functions such as "random", "floor", etc. in AngularDart? I know this can be done in AngularJS but I'm new to AngularDart and can't figure out what I'm missing (maybe an 'import') in order to do so.

The following is what I've imported:

import 'package:math/math.dart';
import 'package:math_expressions/math_expressions.dart';
1
Did you try to find the documentation? Or the sources which can be found via Google at Google? Is there any reason that you have to mention the framework Angular for some basic language features (goes for javascript as well)?Lutz Lehmann

1 Answers

3
votes

This has nothing to do with AngularDart. You can use them everywhere, where you can write Dart code. Some basic math methods are in the math package but methods that only take one argument are often methods of the int/double/num type itself.

new Random().nextInt(100);

(100/3).floor();