uri_ with_ interpolation
Details about the 'uri_with_interpolation' diagnostic produced by the Dart analyzer.
URIs can't use string interpolation.
Description
#
The analyzer produces this diagnostic when the string literal
in an
import, export, or
part directive contains an interpolation. The
resolution of the URIs in directives must happen before the
declarations are compiled, so expressions can't be evaluated
while determining the values of the URIs.
Example
#
The following code produces this diagnostic because the string
in the
import directive contains an interpolation:
import 'dart:$m';
const m = 'math';
Common fixes
#Remove the interpolation from the URI:
import 'dart:math';
var zero = min(0, 0);
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.