Dart convert int variable to string

I'm trying to convert an integer variable

var int counter = 0;

into a string variable

var String $counter = "0";

I searched but I only found something like

var myInt = int.parse('12345');

that doesn't work with

var myInt = int.parse(counter);

Use toString and/or toRadixString

  int intValue = 1;
  String stringValue = intValue.toString();
  String hexValue = intValue.toRadixString(16);

or, as in the commment

  String anotherValue = 'the value is $intValue';

// String to int

String s = "45";
int i = int.parse(s);

// int to String

int j = 45;
String t = "$j";

// If the latter one looks weird, look into string interpolation on https://dart.dev


You can use the .toString() function in the int class.

int age = 23;
String tempAge = age.toString();

then you can simply covert integers to the Strings.