getDeprecationReason function
String?
getDeprecationReason(
- Element element
)
Implementation
String? getDeprecationReason(Element element) {
final doc = getDocumentation(element);
if (doc?.deprecationReason != null) {
return doc?.deprecationReason;
}
final depAnn =
const TypeChecker.fromRuntime(Deprecated).firstAnnotationOf(element);
if (depAnn != null) {
final dep = ConstantReader(depAnn);
final reason =
dep.peek('message')?.stringValue ?? 'Expires: ${deprecated.message}.';
return reason;
}
return null;
}