prefix_shadowed_by_local_declaration
字首 '{0}' 不能在此處使用,因為它被區域性宣告遮蔽了。
描述
#當匯入字首在一個因被區域性宣告遮蔽而不可見的上下文中使用時,分析器會產生此診斷。
示例
#以下程式碼產生此診斷,因為字首 a 被用於訪問類 Future,但由於被引數 a 遮蔽而不可見
dart
import 'dart:async' as a;
a.Future? f(int a) {
a.Future? x;
return x;
}常見修復方法
#重新命名字首
dart
import 'dart:async' as p;
p.Future? f(int a) {
p.Future? x;
return x;
}或重新命名區域性變數
dart
import 'dart:async' as a;
a.Future? f(int p) {
a.Future? x;
return x;
}