Default Value and Type Conversion In Dart

Default Value and Type Conversion In Dart

What are Default value:

Default values are those value which are assigned to the IDE before we initialize any datatype. These default values are Null and does not return any output, Or In other Words if we does not provide value to variable, it will store Null value.

Type Conversion:

Type conversion as we discussed above is the change of a data type to another data type for different use in application.

  • String to int Conversion

  • String to double Conversion

  • int to String Conversion

  • double to String Conversion

void main() {
  // * String to int
  int a = 10;

  var b = int.parse("20");

  print(a + b);

  // *  String to Double'

  var d = double.parse("0.20");
  print(d);
  //double e = double.parse((c + d).toString());

  //print(e);
  //int to String
  var f = 5.toString();
  int g = int.parse(f);
  print(g);

}