int to string dart

75

//valid for any i
int i == int.parse(i.toString())
// int to String
int j = 45;
String t = "$j";

//Use toString and/or toRadixString
int intValue = 1;
String stringValue = intValue.toString();
String hexValue = intValue.toRadixString(16);
// or 
 String anotherValue = 'the value is $intValue';

//String to int
String s = "45";
int i = int.parse(s);
// int -> String
main () {
    String oneAsString = 1.toString();
    print(oneAsString == '1'); // prints true
}

Comments

Submit
0 Comments