conditional_uri_does_not_exist
Missing conditional import.
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';
Enable
#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
If you're instead using the YAML map syntax to configure linter rules, add conditional_uri_does_not_exist: true
under linter > rules:
analysis_options.yaml
yaml
linter:
rules:
conditional_uri_does_not_exist: true
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-03-07. View source or report an issue.