conditional_uri_does_not_exist
Missing conditional import.
This rule is available as of Dart 2.16.0.
Details
#DON'T reference files that do not exist in conditional imports.
Code may fail at runtime if the condition evaluates such that the missing file needs to be imported.
BAD:
dart
import 'file_that_does_exist.dart'
if (condition) 'file_that_does_not_exist.dart';
GOOD:
dart
import 'file_that_does_exist.dart'
if (condition) 'file_that_also_does_exist.dart';
Usage
#To enable the conditional_uri_does_not_exist
rule,
add conditional_uri_does_not_exist
under linter > rules in your
analysis_options.yaml
file:
analysis_options.yaml
yaml
linter:
rules:
- conditional_uri_does_not_exist
除非另有说明,文档之所提及适用于 Dart 3.5.0 版本,本页面最后更新时间: 2024-09-22。 查看文档源码 或者 报告页面问题。