johan
johan

Reputation: 21

Merge string item in list with another string

Is there any way to merge String item in list with another string ? for example:
I have this list

final list1 = ['Hello'];

i need when click on button add World word to Hello word so the list will be ['Hello World']

Upvotes: 1

Views: 75

Answers (1)

CopsOnRoad
CopsOnRoad

Reputation: 268544

Use

final list1 = ['Hello']; // given

String hello = list1[0]; // get first letter
String world = 'World'; // letter you want to add

list1[0] = hello + ' ' + world; // concatenate both string and update list

Upvotes: 1

Related Questions