Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the PI constant in Dart

Tags:

flutter

dart

I imported math.

import 'dart:math'; 

But how can I call "PI" constant?

This is not working.

   math.pi / 12.0 
like image 212
Muhammed Ozdogan Avatar asked Sep 30 '18 11:09

Muhammed Ozdogan


People also ask

How do you find the Pi value in darts?

First import 'dart:math'; then use pi/12.0 instead of math. PI/12.0 it should work fine.


1 Answers

you should import 'dart:math' as math; instead of just import 'dart:math';

because when you use the as keyword you provide the imported library a name so you can reference it anywhere in your file

like image 56
Raouf Rahiche Avatar answered Sep 22 '22 23:09

Raouf Rahiche