getClassFromFile method Null safety
Implementation
ClassDeclaration? getClassFromFile(String className, Uri fileUri) {
try {
return _getFileAstRoot(fileUri)
.declarations
.whereType<ClassDeclaration>()
.firstWhere((c) => c.name.value() == className);
} catch (e) {
if (e is StateError || e is TypeError || e is ArgumentError) {
return null;
}
rethrow;
}
}