Chapter 3 | Type Casting in Dart
Published in
Dec 12, 2020
In this chapter, we will learn how to convert the data type of one variable into another.
- String to int Conversion: we use int.parse() to convert a string into integer if it’s compatible.
- String to double Conversion: we use double.parse() to convert a string into floating point value (like 2.2) if it’s compatible.
- int to String Conversion: we use toString() to convert an integer value into a string value.
- double to String Conversion: we use toStringAsFixed() to convert a double value into a string value.
Here’s the source code (wait for it to load):
That’s it for this chapter. See you in the next one. Bbye!