The log() function in Dart calculates the natural logarithm of a number.
The image below shows the mathematical representation of the log() function.
The
dart:mathmodule is required for this function.
double log(double num)
This function requires:
log() returns the natural logarithm of the number sent as a parameter.
log() returns NaN.log() returns negativeinfinity.The following code shows how to use log() in Dart.
import 'dart:convert';import 'dart:math';void main() {//positive numberprint("The value of log(10) = ${log(10)}");// eprint("The value of log(e) = ${log(e)}");//negative numberprint("The value of log(-2) = ${log(-2)}");//zero numberprint("The value of log(0) = ${log(0)}");}