如何修复错误:没有为类“elements2”定义getter“ListLiteral”。创建字符串转换(.arb文件)时
我正在尝试生成字符串本地化文件,但当我运行
flutter pub run intl_translation:extract_to_arb --output-dir="lib/l10n" lib/localization/localizations.dart
它显示以下错误:
Failed to precompile intl_translation:extract_to_arb:
file:///D:/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/intl_translation-0.17.4/lib/src/intl_message.dart:94:22: Error: The getter 'elements2' isn
't defined for the class 'ListLiteral'.
- 'ListLiteral' is from 'package:analyzer/dart/ast/ast.dart' ('file:///D:/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.34.3/lib/dart/a
st/ast.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'elements2'.
if (!identifiers.elements2.every((each) => each is SimpleIdentifier)) {
^^^^^^^^^
通过遵循这个video,我已经将"l10n“添加到我的lib https://1drv.ms/u/s!AijASouhGkzqhIkjFGQbx7Wg7knsVg (这是显示我拥有的lib目录的屏幕截图)
这是我的localizations.dart文件。
转载请注明出处:http://www.cospi.net/article/20230401/1544748.html