Convert a List<int> into a String in Dart?

String.fromCharCodes(List<int> charCodes) is probably what you're looking for.

  List<int> charCodes = const [97, 98, 99, 100];
  print(new String.fromCharCodes(charCodes));

You can use the dart:convert library which provides an UTF-8 codec:

import 'dart:convert';

void main() {
  List<int> charCodes = [97, 98, 99, 100];
  String result = utf8.decode(charCodes);
  print(result);
}

As mentioned String.fromCharCodes(List<int> charCodes) is likely what you are looking for if you want to convert unicode characters into a String. If however all you wanted was to merge the list into a string you can use Strings.join(List<String> strings, String separator).

Strings.join([1,2,3,4].map((i) => i.toString()), ","))  // "1,2,3,4"

Update (new Dart versions): Strings.join is no longer valid so you must use this instead:

[1,2,3,4].map((i) => i.toString()).join(",");

Tags:

Dart