英文:
AWS Amplify DataStore displaying as-it-is string data with '\n' (New line character) without creating a new line in Flutter 'Text' class
问题
I've a small doubt on displaying data through AWS Amplify DataStore.
I've the below model in schema.graphql:
type ItemFaq @model @auth(rules: [{allow: public}]) {
id: ID!
indexItemFaq: Int
titleItemFaq: String
subtitleItemFaq: String
}
I've deployed data model in AWS Amplify and updated sample data with a new line character - as shown below:
In my Flutter App, I wanted to show data in a new line using Flutter 'Text' class, but instead, I'm getting the data retrieved from AWS Amplify as shown below:
How can I make use of Flutter 'Text' class to show data in a new line when retrieving data from AWS Amplify?
英文:
I've a small doubt on displaying data through AWS Amplify DataStore.
I've the below model in schema.graphql
type ItemFaq @model @auth(rules: [{allow: public}]) {
id: ID!
indexItemFaq: Int
titleItemFaq: String
subtitleItemFaq: String
}
I've deployed data model in AWS Amplify and updated sample data with new line character - as shown below:
In my Flutter App, I wanted to show data in newline using Flutter 'Text' class, but instead I'm getting the data retrieved from AWS Amplify as shown below:
How can I make use of Flutter 'Text' class to show data in new line when retrieving data from AWS Amplify?
答案1
得分: 1
尝试这个:
Text(
'subtitle'.replaceAll('\\n', '\n'),
)
英文:
Try this:
Text(
'subtitle'.replaceAll('\\n', '\n'),
),
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论