invalid_platforms_field
The 'platforms' field must be a map with platforms as keys.
Description
#The analyzer produces this diagnostic when a top-level platforms
field is specified, but its value is not a map with keys.
To learn more about specifying your package's supported platforms,
check out the documentation on platform declarations.
Example
#The following pubspec.yaml
produces this diagnostic because platforms
should be a map.
name: example
platforms:
- android
- web
- ios
Common fixes
#If you can rely on automatic platform detection, then omit the
top-level platforms
field.
name: example
If you need to manually specify the list of supported platforms, then
write the platforms
field as a map with platform names as keys.
name: example
platforms:
android:
web:
ios:
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。