这里使用一个建议图案Intl.message我已经随处可见:为什么intl.Message需要封装在封闭函数中?
final String learnMoreLabel = _learnMoreLabel; String get
_learnMoreLabel => Intl.message('Learn more',
name: 'HelpContentBase__learnMoreLabel',
desc: 'The label for a link or button which takes the user to the '
'Google Help Center to read more information on a topic.');
为什么我不能只是写:
final String learnMoreLabel = Intl.message('Learn more',
name: 'HelpContentBase__learnMoreLabel',
desc: 'The label for a link or button which takes the user to the '
'Google Help Center to read more information on a topic.');
为什么它需要被包裹在吸气?我在the docs中发现了这一点:
将此消息用于将被翻译为不同语言环境的消息。 预期的用法是它位于一个封闭函数中, 仅返回此调用的值,并为将在消息中替换的 变量提供一个范围。
但它不会说为什么。