Reputation: 1679
I have a variable in declared in flutter and I want to print it as a string with a quotation mark around it something like this:
String name = "samuel";
so when I print it out I would get double quotations around it
"Samuel"
i tried
print("'" + name +"'")
print('"' + name + '"')
print("\"" + name + "\"")
but none worked. Please, how can I achieve this in dart?
Upvotes: 0
Views: 3155
Reputation: 657158
You can use
print('"$name"')
print("'$name'") // prints ' quotes
print('\"$name\"')
Upvotes: 1