Reputation: 326
I knows print() will useful but how to merge or concat two string variables. like print(" "+str1+" "+str2)
Upvotes: 16
Views: 52868
Reputation: 6867
It is more of a dart question. You can achieve that using:
print('Something $string1 something more ${someObject.string2} even more $string3');
Upvotes: 38
Reputation: 277167
In dart there are many string options.
For concatenation, you can do :
'hello $myVariable'
"hello ${myVariable.myProperty}"
'hello ' 'world'
(only works with string literals)'hello' + myVariable
So in your case, you can do a print(" $str1 $str2")
Use $var instead of ${var} here
Upvotes: 34