How to convert Double to Integer or Integer to double in Dart| Flutter By Example

March 12, 2023 · 4 min read

This tutorial shows multiple ways to Convert Double to Int and Int to double in Dart and Flutter programming. Convert Double to Int in Dart: First Way, use double.toInt() method, For example: 3.4.toInt() returns int value 3. Second way, use double.truncate() method to remove decimals from a number.3.4.truncate() returns int value 3. Third way, use rounding methods such as round, ceil, and floor based on lower or upper value of a given number....