Dart num remainder()
Syntax & Examples
num.remainder() method
The `remainder` method in Dart returns the remainder of the truncating division of this by another number.
Syntax of num.remainder()
The syntax of num.remainder() method is:
 num remainder(num other) This remainder() method of num returns the remainder of the truncating division of this by other.
Parameters
| Parameter | Optional/Required | Description | 
|---|---|---|
other | required | The number by which to divide. | 
Return Type
num.remainder() returns value of type  num.
✐ Examples
1 Remainder of integer division
In this example,
- We create two num variables, 
dividendwith the value 10 anddivisorwith the value 3. - We use the 
remainder()method to find the remainder ofdividenddivided bydivisor. - We then print the result to standard output.
 
Dart Program
void main() {
  num dividend = 10;
  num divisor = 3;
  num remainderValue = dividend.remainder(divisor);
  print('Remainder of $dividend divided by $divisor: $remainderValue');
}Output
Remainder of 10 divided by 3: 1
2 Remainder of decimal division
In this example,
- We create two num variables, 
dividendwith the value 7.5 anddivisorwith the value 2. - We use the 
remainder()method to find the remainder ofdividenddivided bydivisor. - We then print the result to standard output.
 
Dart Program
void main() {
  num dividend = 7.5;
  num divisor = 2;
  num remainderValue = dividend.remainder(divisor);
  print('Remainder of $dividend divided by $divisor: $remainderValue');
}Output
Remainder of 7.5 divided by 2: 1.5
Summary
In this Dart tutorial, we learned about remainder() method of num: the syntax and few working examples with output and detailed explanation for each example.