avoid_web_libraries_in_flutter
Avoid using web-only libraries outside Flutter web plugin packages.
此规则自 Dart 2.6 版本起可用。
_规则集:flutter _
详情
#AVOID using web libraries, dart:html, dart:js and dart:js_util in Flutter packages that are not web plugins. These libraries are not supported outside of a web context; functionality that depends on them will fail at runtime in Flutter mobile, and their use is generally discouraged in Flutter web.
Web library access is allowed in:
- plugin packages that declare
webas a supported context
otherwise, imports of dart:html, dart:js and dart:js_util are disallowed.
使用方法
#要启用 avoid_web_libraries_in_flutter 规则,请在你的 analysis_options.yaml 文件中,在 linter > rules 下添加 avoid_web_libraries_in_flutter :
linter:
rules:
- avoid_web_libraries_in_flutter除非另有说明,否则本网站上的文档反映的是 Dart 3.6.0。页面最后更新于 2025-02-05。 查看源代码 或 报告问题.