抖动问题:多行描述值出现错误

时间:2020-04-18 13:21:40

标签: flutter

我有一个多行描述,如下所示:

List<Hymnal> _items = [
Hymnal(
    id: '1',
    indexNumber: '001',
    title: 'O Worship the Lord',
    hymns: 
    " 1
      O worship the Lord in the beauty of holiness,
      Bow down before Him, His glory proclaim;
      With gold of obedience, and incense of lowliness,
      Kneel and adore Him: the Lord is His name.")];

上面的行引起了一些问题,因为我猜赞美诗的格式。这是硬编码的,我只是将其放在Hymns.dart中。 有关如何解决此问题的任何建议?

1 个答案:

答案 0 :(得分:1)

对于多行字符串,您必须使用三个引号:

hymns: 
  ''' 1
   O worship the Lord in the beauty of holiness,
   Bow down before Him, His glory proclaim;
   With gold of obedience, and incense of lowliness,
   Kneel and adore Him: the Lord is His name.'''

This可以提供帮助。