getJsonAnyGetter method Null safety

MethodMirror? getJsonAnyGetter(
  1. [dynamic scheme]
)

Implementation

MethodMirror? getJsonAnyGetter([dynamic scheme]) {
  MethodMirror? result;
  try {
    result =
        classMirror.declarations.values.firstWhere((DeclarationMirror dm) {
      return !dm.isPrivate &&
          dm is MethodMirror &&
          !dm.isConstructor &&
          dm.parameters.isEmpty &&
          dm.hasReflectedReturnType &&
          dm.reflectedReturnType.toString() == 'Map<String, dynamic>' &&
          getDeclarationMeta(dm, scheme) != null;
    }) as MethodMirror?;
  } catch (error) {
    result = null;
  }
  return result;
}